Repository navigation
Conversation
|
Heads-up on the two red checks — neither is caused by this PR:
Locally on macOS (with
Happy to rebase once #635 lands if you would rather see a green CI run first. |
Adds Polish to the app language picker (Settings -> Advanced -> Language), following the same pattern used when Russian (SuperCmdLabs#145) and Italian (SuperCmdLabs#305) were added. - New src/renderer/src/i18n/locales/pl.json, hand-translated from en.json with full structural parity (982 keys, 0 missing / 0 extra / 0 invalid). - runtime.ts: pl added to SupportedAppLocale, APP_LANGUAGE_OPTIONS, MESSAGE_CATALOG, normalizeAppLanguage and resolveAppLocale, so a system locale of pl-PL resolves to Polish automatically. - settings-store.ts: pl added to the AppLanguage union and to the main process copy of normalizeAppLanguage, so the setting persists instead of being coerced back to 'system' on load and on every patch. - electron.d.ts: appLanguage union widened to match. - settings.general.language.pl display name added to all 10 existing locale files, in each target language. - Refreshed the stale locale lists in docs/i18n-architecture.md and CLAUDE.md, which were still missing ru and/or it. No existing locale strings, keys or runtime behaviour are changed. Claude-Session: https://claude.ai/code/session_01DM3kF3wjMpoDJSUWApqsJ5
f99caf7 to
df54948
Compare
|
Self-review pass — pushed four copy fixes after checking every interpolated string against its actual call site rather than trusting 1. 2. 3. 4. Re-verified after the change: Two pre-existing bugs I ran into while doing this. Both are outside the scope of a localization PR so I have not touched them, but they affect every locale:
Happy to send either as a separate PR if you want them. |
What changed
Adds Polish (
pl) as a selectable app display language, alongside the ten locales already supported. Follows the exact pattern used when Russian (#145) and Italian (202109b, #305) were added.New file
src/renderer/src/i18n/locales/pl.json— full Polish translation ofen.json(982 keys).Wiring
src/renderer/src/i18n/runtime.ts—pladded to the import list,SupportedAppLocale,APP_LANGUAGE_OPTIONS,MESSAGE_CATALOG,normalizeAppLanguage()andresolveAppLocale().src/main/settings-store.ts—pladded to theAppLanguageunion and to the main-process copy ofnormalizeAppLanguage(). This second one is easy to miss: without it the renderer sendsappLanguage: 'pl', the main process normalises it back to'system'on both the load path and the patch path, and the picker silently snaps back after a restart.src/renderer/types/electron.d.ts—appLanguageunion widened to match.Display name
settings.general.language.pladded to all 10 existing locale files, in each target language (Polnisch,Polonais,Polaco,Polacco,Польский,ポーランド語,폴란드어,波兰语,波蘭語). That matches the convention of the two most recent additions (ru,it), which are localized exonyms; the older entries infr/de/es/koare a mix of endonyms and exonyms and were left untouched.Docs
docs/i18n-architecture.mdandCLAUDE.mdstill listed the supported locales as ending ates/ru— both were already missingit, and the doc was also missingru. Refreshed to the actual current set, including the inline parity-check snippet inCLAUDE.md.No TSX changes were needed:
AdvancedTab.tsxalready rendersAPP_LANGUAGE_OPTIONS.map(...)with a dynamict('settings.general.language.' + option)lookup.Why
The app already ships Polish dictation (
pl-PL, added in #442), so the UI language was the missing half. Adding a locale here is meant to be a resource-only change — which is exactly the stated goal indocs/i18n-architecture.md.Compatibility impact
DEFAULT_APP_LANGUAGEis still'system'.settings.jsoncontaining"appLanguage": "pl"falls throughnormalizeAppLanguage()to'system'— the existing, intended behaviour for unknown values. No migration needed.pl-PLsystem locale withappLanguage: 'system'will now see Polish instead of English. That is the intended behaviour of every locale addition in this repo, and it is opt-out via the picker.dist/renderer, already covered by the"dist/**/*"glob inbuild.files.How I tested
Also verified the Polish strings actually land in the bundle (
grep "Jak w systemie" dist/renderer/assets/*.js).Two honest notes:
tsc -p tsconfig.renderer.jsonreports 44 errors on a clean checkout ofmain, before this change. I diffed the error sets with and without my commit — they are identical apart from one pre-existing error inruntime.ts(Type alias 'MessageTree' circularly references itself) shifting from line 15 to 16 because of the added import. This PR introduces zero new type errors. There is notypecheckscript and CI does not runtsc, so this is pre-existing.npm run check:i18nalso prints a pre-existing warning forit(missingsettings.ai.whisper.vocabulary.*andsettings.extensions.appSearchScope.*, left behind by feat:add searchApplicationsScope to settings.json #466 and feat(whisper): custom vocabulary biasing for local whisper.cpp #467). Untouched here — I deliberately left it out to keep this PR to one concern, and I'm happy to send it as a separate PR if useful.I could not run
npm run build:native/npm run devend-to-end in this environment:npm cifails on Apple Silicon because@esbuild/darwin-x64is a direct (non-optional) dependency and npm rejects it withEBADPLATFORMonarm64. That is the same issue #635 is fixing; I worked around it withnpm ci --ignore-scripts --force. So the runtime restart-persistence check onsettings-store.tsis reasoned-through rather than clicked-through — worth a reviewer's second look if you have a working dev setup.Translation quality — for a reviewer who doesn't read Polish
I'm a native Polish speaker and this is hand-translated from
en.jsononly — no file was copied from another locale as a base (perCLAUDE.mdrule 6). Register follows Apple's Polish macOS conventions: nominal section titles, imperative buttons, impersonal-no/-toforms for completed actions (Zapisano,Odinstalowano) so nothing is gendered, infinitive questions for confirmations (Odinstalować „{name}"?), and sentence case throughout — Polish does not use Title Case. Terminology is anchored on macOS PL: Clipboard→Schowek, Shortcut→Skrót, Trash→Kosz, Appearance→Wygląd, tab→kartavs bookmark→zakładka.Brand terms are kept verbatim: SuperCmd, Whisper, Parakeet, Qwen3, ggml, CoreML, ElevenLabs, OpenAI, Anthropic, Gemini, Ollama, LM Studio, Raycast, Excalidraw, Supermemory, and all model names.
One deliberate deviation worth flagging. Two strings use
{plural}, which carries English morphology (""or"s") —canvas.countandsettings.ai.speak.elevenlabs.voice.available. Polish has three numeral forms (1 / 2–4 / 5+) that the runtime cannot express, and injecting{plural}would emit a literals. I dropped only that token in those two strings and rephrased to a label-colon-number form that needs no agreement (Tablice: {count}).{count}is preserved. Every other placeholder in all 982 keys is preserved verbatim — verified mechanically below.Three checks a non-Polish speaker can run:
1. Structural parity (must exit 0)
2. Placeholder parity per key (reports 0 mismatches; the two
{plural}drops above are the only allowed exceptions)node -e 'const fs=require("fs"),d="src/renderer/src/i18n/locales/";const f=(o,p="",r={})=>{for(const k of Object.keys(o)){const v=o[k],q=p?p+"."+k:k;v&&typeof v==="object"?f(v,q,r):r[q]=v}return r};const en=f(JSON.parse(fs.readFileSync(d+"en.json","utf8"))),pl=f(JSON.parse(fs.readFileSync(d+"pl.json","utf8")));const A={"canvas.count":["plural"],"settings.ai.speak.elevenlabs.voice.available":["plural"]};const t=s=>[...String(s).matchAll(/\{([^}]+)\}/g)].map(m=>m[1]).sort();let b=0;for(const k in en){const x=t(en[k]),y=t(pl[k]??""),a=A[k]||[];const m=x.filter(i=>!y.includes(i)&&!a.includes(i)),v=y.filter(i=>!x.includes(i));if(m.length||v.length){b++;console.log(k,m,v)}}console.log(b?b+" mismatches":"placeholders OK")'3. Brand terms preserved (counts should match
en.json)For context, here is the state of every locale measured against
en.json. "Identical" counts values byte-identical to the English one — that number is never 0 for any language, because brand names, API-key placeholders and URLs are supposed to stay as-is. The second column is the one that matters: values that are unambiguously untranslated English sentences (contain a space, end in./!/?).rudefresitjazh-Hanszh-Hantkopl(this PR)pl.json's 54 identical values are exclusively brand/product names (SuperCmd Whisper,Parakeet TDT v3,ElevenLabs Scribe v1,LM Studio, …), API-key placeholders (sk-...,client-123,https://api.supermemory.ai), and single technical tokens (OK,Alias,Host,Enter,Hindi,AI,LLM) — plus two pure-placeholder strings ({progress}% · {transferred} / {total},Bang !{bang}). None of them is an English sentence. Reproduce with:node -e 'const fs=require("fs"),d="src/renderer/src/i18n/locales/";const f=(o,p="",r={})=>{for(const k of Object.keys(o)){const v=o[k],q=p?p+"."+k:k;v&&typeof v==="object"?f(v,q,r):r[q]=v}return r};const en=f(JSON.parse(fs.readFileSync(d+"en.json","utf8")));const S=v=>{const s=String(v).trim();return /\s/.test(s)&&/[.!?]$/.test(s)&&!/^https?:/.test(s)};for(const l of ["ru","de","fr","es","it","ja","ko","zh-Hans","zh-Hant","pl"]){const o=f(JSON.parse(fs.readFileSync(d+l+".json","utf8")));const same=Object.keys(en).filter(k=>k in o&&en[k]===o[k]);console.log(l.padEnd(9),"identical:",String(same.length).padStart(3)," sentences:",same.filter(k=>S(en[k])).length)}'https://claude.ai/code/session_01DM3kF3wjMpoDJSUWApqsJ5