From 5faf3b2ea066d31729411b251e456ceb438e8ae3 Mon Sep 17 00:00:00 2001 From: Brennan Benson <79079362+brennanb2025@users.noreply.github.com> Date: Sat, 25 Jul 2026 03:35:13 -0700 Subject: [PATCH] fix(i18n): keep the macOS "Local Network" wording searchable in every locale (#10536) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- .../developer-permissions-search.test.ts | 63 +++++++++++++++++++ .../settings/developer-permissions-search.ts | 11 +++- src/renderer/src/i18n/locales/en.json | 3 +- src/renderer/src/i18n/locales/es.json | 1 + src/renderer/src/i18n/locales/ja.json | 1 + src/renderer/src/i18n/locales/ko.json | 1 + src/renderer/src/i18n/locales/zh.json | 3 +- 7 files changed, 78 insertions(+), 5 deletions(-) create mode 100644 src/renderer/src/components/settings/developer-permissions-search.test.ts diff --git a/src/renderer/src/components/settings/developer-permissions-search.test.ts b/src/renderer/src/components/settings/developer-permissions-search.test.ts new file mode 100644 index 000000000..65e40b193 --- /dev/null +++ b/src/renderer/src/components/settings/developer-permissions-search.test.ts @@ -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 { + 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(['局域网', '本地网络'])) + }) +}) diff --git a/src/renderer/src/components/settings/developer-permissions-search.ts b/src/renderer/src/components/settings/developer-permissions-search.ts index 9efad1302..7718bbdeb 100644 --- a/src/renderer/src/components/settings/developer-permissions-search.ts +++ b/src/renderer/src/components/settings/developer-permissions-search.ts @@ -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', diff --git a/src/renderer/src/i18n/locales/en.json b/src/renderer/src/i18n/locales/en.json index 3e9cb3c62..71aef99a9 100644 --- a/src/renderer/src/i18n/locales/en.json +++ b/src/renderer/src/i18n/locales/en.json @@ -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", diff --git a/src/renderer/src/i18n/locales/es.json b/src/renderer/src/i18n/locales/es.json index 7d5093249..38bd42096 100644 --- a/src/renderer/src/i18n/locales/es.json +++ b/src/renderer/src/i18n/locales/es.json @@ -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", diff --git a/src/renderer/src/i18n/locales/ja.json b/src/renderer/src/i18n/locales/ja.json index 53797ce82..7d4a14ba7 100644 --- a/src/renderer/src/i18n/locales/ja.json +++ b/src/renderer/src/i18n/locales/ja.json @@ -7665,6 +7665,7 @@ "e3fbc48083": "ブルートゥース", "c4a4a02ea4": "USB", "fa3239cd42": "ローカルネットワーク", + "87620e6416": "LAN", "acad3d4743": "terminal セッションから使用されるデバイス ツールと LAN アクセスを許可します。", "3e0131e45d": "icloud", "ce07159ff5": "デスクトップ", diff --git a/src/renderer/src/i18n/locales/ko.json b/src/renderer/src/i18n/locales/ko.json index dd9832c80..f4a063ce1 100644 --- a/src/renderer/src/i18n/locales/ko.json +++ b/src/renderer/src/i18n/locales/ko.json @@ -7628,6 +7628,7 @@ "e3fbc48083": "블루투스", "c4a4a02ea4": "USB", "fa3239cd42": "로컬 네트워크", + "87620e6416": "LAN", "acad3d4743": "terminal 세션에서 사용되는 장치 도구와 LAN 액세스를 허용합니다.", "3e0131e45d": "icloud", "ce07159ff5": "데스크탑", diff --git a/src/renderer/src/i18n/locales/zh.json b/src/renderer/src/i18n/locales/zh.json index 0d77a7280..f8d65c5be 100644 --- a/src/renderer/src/i18n/locales/zh.json +++ b/src/renderer/src/i18n/locales/zh.json @@ -7627,7 +7627,8 @@ "78a10b826f": "你好", "e3fbc48083": "蓝牙", "c4a4a02ea4": "USB", - "fa3239cd42": "局域网", + "fa3239cd42": "本地网络", + "87620e6416": "局域网", "acad3d4743": "允许从终端会话使用设备工具和局域网访问。", "3e0131e45d": "云", "ce07159ff5": "桌面",