Skip to content

Commit 57750bd

Browse files
committed
feat(i18n): update instructions in CONTRIBUTING.md
1 parent 1240f67 commit 57750bd

1 file changed

Lines changed: 13 additions & 19 deletions

File tree

CONTRIBUTING.md

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ This focus helps guide our project decisions as a community and what we choose t
4343
- [RTL Support](#rtl-support)
4444
- [Localization (i18n)](#localization-i18n)
4545
- [Approach](#approach)
46+
- [i18n commands](#i18n-commands)
4647
- [Adding a new locale](#adding-a-new-locale)
4748
- [Update translation](#update-translation)
4849
- [Adding translations](#adding-translations)
@@ -378,6 +379,17 @@ npmx.dev uses [@nuxtjs/i18n](https://i18n.nuxtjs.org/) for internationalization.
378379
- We use the `no_prefix` strategy (no `/en-US/` or `/fr-FR/` in URLs)
379380
- Locale preference is stored in cookies and respected on subsequent visits
380381

382+
### i18n commands
383+
384+
The following scripts help manage translation files. `en.json` is the reference locale.
385+
386+
| Command | Description |
387+
| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
388+
| `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+
381393
### Adding a new locale
382394

383395
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.
@@ -421,25 +433,7 @@ Check [Pluralization rule callback](https://vue-i18n.intlify.dev/guide/essential
421433
We track the current progress of translations with [Lunaria](https://lunaria.dev/) on this site: https://i18n.npmx.dev/
422434
If you see any outdated translations in your language, feel free to update the keys to match the English version.
423435

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).
443437

444438
#### Country variants (advanced)
445439

0 commit comments

Comments
 (0)