You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`pnpm i18n:check [locale]`| Compares `en.json` with other locale files. Shows missing and extra keys. Optionally filter output by locale (e.g. `pnpm i18n:check ja-JP`). |
389
+
|`pnpm i18n:check:fix [locale]`| Same as check, but adds missing keys to other locales with English placeholders. |
390
+
|`pnpm i18n:report`| Audits translation keys against code usage in `.vue` and `.ts` files. Reports missing keys (used in code but not in locale), unused keys (in locale but not in code), and dynamic keys. |
391
+
|`pnpm i18n:report:fix`| Removes unused keys from `en.json` and all other locale files. |
392
+
381
393
### Adding a new locale
382
394
383
395
We are using localization using country variants (ISO-6391) via [multiple translation files](https://i18n.nuxtjs.org/docs/guide/lazy-load-translations#multiple-files-lazy-loading) to avoid repeating every key per country.
We track the current progress of translations with [Lunaria](https://lunaria.dev/) on this site: https://i18n.npmx.dev/
422
434
If you see any outdated translations in your language, feel free to update the keys to match the English version.
423
435
424
-
In order to make sure you have everything up-to-date, you can run:
425
-
426
-
```bash
427
-
pnpm i18n:check <country-code>
428
-
```
429
-
430
-
For example to check if all Japanese translation keys are up-to-date, run:
431
-
432
-
```bash
433
-
pnpm i18n:check ja-JP
434
-
```
435
-
436
-
To automatically add missing keys with English placeholders, use `--fix`:
437
-
438
-
```bash
439
-
pnpm i18n:check:fix fr-FR
440
-
```
441
-
442
-
This will add missing keys with `"EN TEXT TO REPLACE: {english text}"` as placeholder values, making it easier to see what needs translation.
436
+
Use `pnpm i18n:check` and `pnpm i18n:check:fix` to verify and fix your locale (see [i18n commands](#i18n-commands) above for details).
443
437
444
438
#### Country variants (advanced)
445
439
@@ -527,6 +521,32 @@ See how `es`, `es-ES`, and `es-419` are configured in [config/i18n.ts](./config/
527
521
- Use `common.*` for shared strings (loading, retry, close, etc.)
528
522
- Use component-specific prefixes: `package.card.*`, `settings.*`, `nav.*`
529
523
- Do not use dashes (`-`) in translation keys; always use underscore (`_`): e.g., `privacy_policy` instead of `privacy-policy`
524
+
-**Always use static string literals as translation keys.** Our i18n scripts (`pnpm i18n:report`) rely on static analysis to detect unused and missing keys. Dynamic keys cannot be analyzed and will be flagged as errors.
0 commit comments