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
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+84Lines changed: 84 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -208,6 +208,90 @@ const props = defineProps<{
208
208
209
209
Ideally, extract utilities into separate files so they can be unit tested. 🙏
210
210
211
+
## Localization (i18n)
212
+
213
+
npmx.dev uses [@nuxtjs/i18n](https://i18n.nuxtjs.org/) for internationalization. We aim to make the UI accessible to users in their preferred language.
214
+
215
+
### Approach
216
+
217
+
- All user-facing strings should use translation keys via `$t()` in templates and script
218
+
- Translation files live in `i18n/locales/` (e.g., `en.json`)
219
+
- We use the `no_prefix` strategy (no `/en/` or `/fr/` in URLs)
220
+
- Locale preference is stored in cookies and respected on subsequent visits
221
+
222
+
### Adding translations
223
+
224
+
1. Add your translation key to `i18n/locales/en.json` first (English is the source of truth)
- Use dot notation for hierarchy: `section.subsection.key`
254
+
- Keep keys descriptive but concise
255
+
- Group related keys together
256
+
- Use `common.*` for shared strings (loading, retry, close, etc.)
257
+
- Use component-specific prefixes: `package.card.*`, `settings.*`, `nav.*`
258
+
259
+
### Using i18n-ally (recommended)
260
+
261
+
We recommend the [i18n-ally](https://marketplace.visualstudio.com/items?itemName=lokalise.i18n-ally) VSCode extension for a better development experience:
262
+
263
+
- Inline translation previews in your code
264
+
- Auto-completion for translation keys
265
+
- Missing translation detection
266
+
- Easy navigation to translation files
267
+
268
+
The extension is included in our workspace recommendations, so VSCode should prompt you to install it.
269
+
270
+
### Adding a new locale
271
+
272
+
1. Create a new JSON file in `i18n/locales/` (e.g., `fr.json`)
0 commit comments