Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ When implementing a new Raycast API:

### Internationalization (i18n)

Locales live in `src/renderer/src/i18n/locales/` — `en.json` is the source of truth, plus `zh-Hans`, `zh-Hant`, `ja`, `ko`, `fr`, `de`, `es`, `ru`.
Locales live in `src/renderer/src/i18n/locales/` — `en.json` is the source of truth, plus `zh-Hans`, `zh-Hant`, `ja`, `ko`, `fr`, `de`, `es`, `ru`, `it`, `pl`.

**Rule: whenever you add, rename, or remove a user-facing string, update every locale file in the same change.** Missing keys fall back to English (or a derived label from the last path segment), which looks broken for non-English users. Keys are only "done" when all locales have them.

Expand All @@ -233,7 +233,7 @@ Checklist when touching `en.json`:
4. Preserve interpolation variables verbatim (`{count}`, `{name}`, `{version}`, `{plural}`, etc.) — translations must keep the same placeholders.
5. Verify structural parity after edits — all locales must have the same set of keys as `en.json`. A quick node check:
```bash
node -e "const fs=require('fs');function k(o,p=''){const r=[];for(const x of Object.keys(o)){const v=o[x],q=p?p+'.'+x:x;v&&typeof v==='object'?r.push(...k(v,q)):r.push(q)}return r}const en=new Set(k(JSON.parse(fs.readFileSync('src/renderer/src/i18n/locales/en.json','utf8'))));for(const l of ['zh-Hans','zh-Hant','ja','ko','fr','de','es','ru']){const s=new Set(k(JSON.parse(fs.readFileSync('src/renderer/src/i18n/locales/'+l+'.json','utf8'))));console.log(l,'missing:',[...en].filter(x=>!s.has(x)).length,'extra:',[...s].filter(x=>!en.has(x)).length)}"
node -e "const fs=require('fs');function k(o,p=''){const r=[];for(const x of Object.keys(o)){const v=o[x],q=p?p+'.'+x:x;v&&typeof v==='object'?r.push(...k(v,q)):r.push(q)}return r}const en=new Set(k(JSON.parse(fs.readFileSync('src/renderer/src/i18n/locales/en.json','utf8'))));for(const l of ['zh-Hans','zh-Hant','ja','ko','fr','de','es','ru','it','pl']){const s=new Set(k(JSON.parse(fs.readFileSync('src/renderer/src/i18n/locales/'+l+'.json','utf8'))));console.log(l,'missing:',[...en].filter(x=>!s.has(x)).length,'extra:',[...s].filter(x=>!en.has(x)).length)}"
```
6. Never copy a locale file wholesale from another language as a starting point — past incidents have left one locale filled with another language's text (e.g. `ja.json` was Chinese). Always translate each value.

Expand Down
4 changes: 2 additions & 2 deletions docs/i18n-architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

- Keep the first rollout small and reviewable.
- Ship app-level localization for English, Simplified Chinese, Traditional Chinese, Japanese,
Korean, French, German, and Spanish.
Korean, French, German, Spanish, Russian, Italian, and Polish.
- Make future locale additions a resource-only change whenever possible.

## Current Design

- Persist the user preference as `appLanguage` in `settings.json`.
- Accept `system`, `en`, `zh-Hans`, `zh-Hant`, `ja`, `ko`, `fr`, `de`, and `es`.
- Accept `system`, `en`, `zh-Hans`, `zh-Hant`, `ja`, `ko`, `fr`, `de`, `es`, `ru`, `it`, and `pl`.
- Resolve `system` at runtime from the renderer locale.
- Store translatable copy under `src/renderer/src/i18n/`.
- Use English as the fallback locale for missing keys.
Expand Down
4 changes: 3 additions & 1 deletion src/main/settings-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,8 @@ export type AppLanguage =
| 'de'
| 'es'
| 'ru'
| 'it';
| 'it'
| 'pl';

export interface AppSettings {
globalShortcut: string;
Expand Down Expand Up @@ -895,6 +896,7 @@ function normalizeAppLanguage(value: any): AppLanguage {
if (normalized === 'es' || normalized.startsWith('es-')) return 'es';
if (normalized === 'ru' || normalized.startsWith('ru-')) return 'ru';
if (normalized === 'it' || normalized.startsWith('it-')) return 'it';
if (normalized === 'pl' || normalized.startsWith('pl-')) return 'pl';
return DEFAULT_SETTINGS.appLanguage;
}

Expand Down
3 changes: 2 additions & 1 deletion src/renderer/src/i18n/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@
"de": "Deutsch",
"es": "Español",
"ru": "Russisch",
"it": "Italienisch"
"it": "Italienisch",
"pl": "Polnisch"
},
"fontSize": {
"title": "Font Size",
Expand Down
3 changes: 2 additions & 1 deletion src/renderer/src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@
"de": "German",
"es": "Spanish",
"ru": "Russian",
"it": "Italian"
"it": "Italian",
"pl": "Polish"
},
"fontSize": {
"title": "Font Size",
Expand Down
3 changes: 2 additions & 1 deletion src/renderer/src/i18n/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@
"de": "Deutsch",
"es": "Español",
"ru": "Ruso",
"it": "Italiano"
"it": "Italiano",
"pl": "Polaco"
},
"fontSize": {
"title": "Font Size",
Expand Down
3 changes: 2 additions & 1 deletion src/renderer/src/i18n/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@
"de": "Deutsch",
"es": "Español",
"ru": "Russe",
"it": "Italien"
"it": "Italien",
"pl": "Polonais"
},
"fontSize": {
"title": "Font Size",
Expand Down
3 changes: 2 additions & 1 deletion src/renderer/src/i18n/locales/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@
"de": "Tedesco",
"es": "Spagnolo",
"ru": "Russo",
"it": "Italiano"
"it": "Italiano",
"pl": "Polacco"
},
"fontSize": {
"title": "Dimensione del testo",
Expand Down
3 changes: 2 additions & 1 deletion src/renderer/src/i18n/locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@
"de": "ドイツ語",
"es": "スペイン語",
"ru": "ロシア語",
"it": "イタリア語"
"it": "イタリア語",
"pl": "ポーランド語"
},
"fontSize": {
"title": "フォントサイズ",
Expand Down
3 changes: 2 additions & 1 deletion src/renderer/src/i18n/locales/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@
"de": "Deutsch",
"es": "Español",
"ru": "Русский",
"it": "이탈리아어"
"it": "이탈리아어",
"pl": "폴란드어"
},
"fontSize": {
"title": "글꼴 크기",
Expand Down
Loading
Loading