fix(i18n): keep the macOS "Local Network" wording searchable in every locale (#10536)

Settings search indexed the macOS privacy-toggle name as English-only
aliases on the LAN keyword, so a Chinese user typing the term macOS
System Settings actually shows them (本地网络) got no hit — zh's catalog
value had been changed to 局域网 (LAN).

Split the two wordings onto their own catalog keys so each locale carries
both: 87620e6416 = LAN, fa3239cd42 = Local Network (its true content
hash). Localized values come from the repo's own LAN title translations
and from macOS 26's SecurityPrivacyExtension Localizable.loctable
(LOCAL_NETWORK), so nothing is invented. ja/ko/es already matched macOS
and are unchanged apart from gaining the LAN key.
This commit is contained in:
Brennan Benson
2026-07-25 03:35:13 -07:00
committed by GitHub
parent 9bc640addb
commit 5faf3b2ea0
7 changed files with 78 additions and 5 deletions
@@ -0,0 +1,63 @@
import { afterAll, describe, expect, it } from 'vitest'
import { i18n } from '@/i18n/i18n'
import { getDeveloperPermissionsPaneSearchEntries } from './developer-permissions-search'
import { matchesSettingsSearch } from './settings-search'
// Strings macOS 26 System Settings itself shows for the Local Network privacy
// toggle (SecurityPrivacyExtension.appex Localizable.loctable, key LOCAL_NETWORK).
const MACOS_LOCAL_NETWORK_LABEL = {
en: 'local network',
es: 'red local',
ja: 'ローカルネットワーク',
ko: '로컬 네트워크',
zh: '本地网络'
} as const
function getLanEntry() {
const entry = getDeveloperPermissionsPaneSearchEntries().find((candidate) =>
candidate.keywords?.includes('usb')
)
if (!entry) {
throw new Error('LAN, USB, and Bluetooth search entry is missing')
}
return entry
}
async function searchInLocale(locale: string, query: string): Promise<boolean> {
await i18n.changeLanguage(locale)
return matchesSettingsSearch(query, getLanEntry())
}
describe('developer permissions LAN search', () => {
afterAll(async () => {
await i18n.changeLanguage('en')
})
it.each(Object.entries(MACOS_LOCAL_NETWORK_LABEL))(
'finds the LAN row from the macOS Local Network wording in %s',
async (locale, label) => {
expect(await searchInLocale(locale, label)).toBe(true)
}
)
it('keeps the English LAN aliases findable in every locale', async () => {
for (const locale of Object.keys(MACOS_LOCAL_NETWORK_LABEL)) {
for (const query of ['lan', 'local network', 'local-network']) {
expect(await searchInLocale(locale, query)).toBe(true)
}
}
})
it('keeps the localized LAN wording findable', async () => {
expect(await searchInLocale('zh', '局域网')).toBe(true)
expect(await searchInLocale('ja', 'LAN')).toBe(true)
expect(await searchInLocale('ko', 'LAN')).toBe(true)
expect(await searchInLocale('es', 'LAN')).toBe(true)
})
it('indexes both wordings as distinct Chinese keywords', async () => {
await i18n.changeLanguage('zh')
expect(getLanEntry().keywords).toEqual(expect.arrayContaining(['局域网', '本地网络']))
})
})
@@ -154,11 +154,16 @@ export const getDeveloperPermissionsPaneSearchEntries = createLocalizedCatalog((
),
keywords: [
// Why: UI says LAN (aligned with mobile), but macOS System Settings still
// labels the privacy toggle "Local Network" — keep both findable.
// labels the privacy toggle "Local Network" — index both through the
// catalogs so every locale keeps the wording macOS actually shows it.
...translateSearchKeyword(
'auto.components.settings.developer.permissions.search.87620e6416',
'lan'
),
...translateSearchKeyword(
'auto.components.settings.developer.permissions.search.fa3239cd42',
'lan',
{ aliases: ['local network', 'local-network'] }
'local network',
{ aliases: ['local-network'] }
),
...translateSearchKeyword(
'auto.components.settings.developer.permissions.search.c4a4a02ea4',
+2 -1
View File
@@ -7702,7 +7702,8 @@
"78a10b826f": "bonjour",
"e3fbc48083": "bluetooth",
"c4a4a02ea4": "usb",
"fa3239cd42": "lan",
"fa3239cd42": "local network",
"87620e6416": "lan",
"acad3d4743": "Allow device tools and LAN access used from terminal sessions.",
"3e0131e45d": "icloud",
"ce07159ff5": "desktop",
+1
View File
@@ -7643,6 +7643,7 @@
"e3fbc48083": "bluetooth",
"c4a4a02ea4": "USB",
"fa3239cd42": "red local",
"87620e6416": "LAN",
"acad3d4743": "Permitir herramientas de dispositivo y acceso LAN desde sesiones de terminal.",
"3e0131e45d": "iCloud",
"ce07159ff5": "escritorio",
+1
View File
@@ -7665,6 +7665,7 @@
"e3fbc48083": "ブルートゥース",
"c4a4a02ea4": "USB",
"fa3239cd42": "ローカルネットワーク",
"87620e6416": "LAN",
"acad3d4743": "terminal セッションから使用されるデバイス ツールと LAN アクセスを許可します。",
"3e0131e45d": "icloud",
"ce07159ff5": "デスクトップ",
+1
View File
@@ -7628,6 +7628,7 @@
"e3fbc48083": "블루투스",
"c4a4a02ea4": "USB",
"fa3239cd42": "로컬 네트워크",
"87620e6416": "LAN",
"acad3d4743": "terminal 세션에서 사용되는 장치 도구와 LAN 액세스를 허용합니다.",
"3e0131e45d": "icloud",
"ce07159ff5": "데스크탑",
+2 -1
View File
@@ -7627,7 +7627,8 @@
"78a10b826f": "你好",
"e3fbc48083": "蓝牙",
"c4a4a02ea4": "USB",
"fa3239cd42": "局域网",
"fa3239cd42": "本地网络",
"87620e6416": "局域网",
"acad3d4743": "允许从终端会话使用设备工具和局域网访问。",
"3e0131e45d": "云",
"ce07159ff5": "桌面",