Skip to content

Commit 424a00e

Browse files
committed
feat(i18n): enhance internationalization workflow and add catalog checks
1 parent 780d076 commit 424a00e

3 files changed

Lines changed: 49 additions & 0 deletions

File tree

.github/copilot-instructions.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,17 @@ helpers — prefer the typed path for new work.
127127
- **Pyodide version is pinned** (`PYODIDE_VERSION` in `runtime.ts` and the
128128
`<script>` tag in `index.html`). Bump both together; Pyodide’s wheel index
129129
is version-specific.
130+
- **Internationalisation is mandatory for user-facing strings**: wrap every
131+
new visible string in `t("English source")` (from `src/i18n/translate`;
132+
the English text _is_ the key). Use `t("Delete {count}", { count })` for
133+
interpolation. Do **not** translate brand names or AI-assistant system
134+
prompts. Watch for `t` shadowing in `.map((t) => …)` (rename the param).
135+
Literal `t("…")` calls are auto-extracted; keys passed only as a variable
136+
(`t(label)`) must be listed in `src/locales/_dynamic-keys.json`. After
137+
adding strings, run the **`🌍 i18n: Extract keys (step 1/2)`** task, fill
138+
the new empty values in `src/locales/fr.json`, then run the
139+
**`🌍 i18n: Check catalog (step 2/2)`** task. See the README
140+
"Internationalisation" section for the full workflow.
130141

131142
## Testing
132143

@@ -153,6 +164,9 @@ done (bug fix, feature, or any phase of a multi-phase task):
153164
a pixel) rather than just calling `window.runtime.*` from
154165
`page.evaluate`, which can silently no-op.
155166
3. **For `src/runtime/*.py` changes**, run pytest (`tests/python`).
167+
4. **When you add or change user-facing strings**, run `npm run i18n:check`
168+
(or the `🌍 i18n: Check catalog (step 2/2)` task). CI fails on missing or
169+
empty catalog keys.
156170

157171
## Git workflow
158172

.github/workflows/tests.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ jobs:
6969
- name: Lint
7070
run: npm run lint
7171

72+
- name: i18n catalog check
73+
run: npm run i18n:check
74+
7275
- name: Run Vitest with coverage
7376
run: npm run test:cov
7477

.vscode/tasks.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,38 @@
134134
},
135135
"problemMatcher": []
136136
},
137+
{
138+
"label": "🌍 i18n: Extract keys (step 1/2)",
139+
"detail": "Step 1/2 — scan src/ for t(\"\") calls and merge new keys into src/locales/fr.json (empty placeholders). Then fill the new French values by hand, and run step 2/2 to verify.",
140+
"type": "shell",
141+
"command": "npm",
142+
"args": ["run", "i18n:extract"],
143+
"options": {
144+
"cwd": "${workspaceFolder}"
145+
},
146+
"group": "build",
147+
"presentation": {
148+
"panel": "dedicated",
149+
"reveal": "always"
150+
},
151+
"problemMatcher": []
152+
},
153+
{
154+
"label": "🌍 i18n: Check catalog (step 2/2)",
155+
"detail": "Step 2/2 — verify every referenced key is present and non-empty in src/locales/fr.json (read-only; same check as CI). Run after filling in the French translations.",
156+
"type": "shell",
157+
"command": "npm",
158+
"args": ["run", "i18n:check"],
159+
"options": {
160+
"cwd": "${workspaceFolder}"
161+
},
162+
"group": "build",
163+
"presentation": {
164+
"panel": "dedicated",
165+
"reveal": "always"
166+
},
167+
"problemMatcher": []
168+
},
137169
{
138170
"label": "🚀 Pytest (Python)",
139171
"type": "shell",

0 commit comments

Comments
 (0)