Add a String
Steps
1. Choose the namespace
| Namespace | Content |
|---|---|
common | UI chrome, buttons, navigation, labels, errors, empty states |
commerce | Cart, checkout, shipping, payment, orders |
account | Login, register, profile, addresses |
legal | Cookie consent, privacy, terms |
2. Add the key to the source locale
Edit packages/i18n/locales/en/{namespace}.json:
{ "actions.add_to_wishlist": "Add to wishlist"}Follow the key naming conventions:
- Dot notation:
section.descriptive_name - Lowercase with underscores
- Keys are sorted alphabetically in the file
3. Add translations
Add the same key to each target locale file:
{ "actions.add_to_wishlist": "Toevoegen aan verlanglijst"}4. Validate
pnpm i18n:checkThis verifies:
- No missing keys in any locale
- Placeholder parity (
{name}must match between source and target) - No empty values
- No extra/unused keys
5. Update coverage report
pnpm i18n:reportThis regenerates the Translation Status page.
Tips
- Always start with the English source β itβs the ground truth
- Keep placeholder names descriptive:
{product_name}not{p} - Use
{name}syntax only (not{{name}}or%s) - Sort keys alphabetically in JSON files for deterministic output
- Run
pnpm i18n:checkbefore committing β it exits with code 1 if keys are missing