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
+83Lines changed: 83 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -208,6 +208,89 @@ 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 or `t()` in 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)
225
+
2. Use the key in your component:
226
+
227
+
```vue
228
+
<template>
229
+
<p>{{ $t('my.translation.key') }}</p>
230
+
</template>
231
+
```
232
+
233
+
Or in script:
234
+
235
+
```typescript
236
+
const { t } =useI18n()
237
+
const message =t('my.translation.key')
238
+
```
239
+
240
+
3. For dynamic values, use interpolation:
241
+
242
+
```json
243
+
{ "greeting": "Hello, {name}!" }
244
+
```
245
+
246
+
```vue
247
+
<p>{{ $t('greeting', { name: userName }) }}</p>
248
+
```
249
+
250
+
### Translation key conventions
251
+
252
+
- Use dot notation for hierarchy: `section.subsection.key`
253
+
- Keep keys descriptive but concise
254
+
- Group related keys together
255
+
- Use `common.*` for shared strings (loading, retry, close, etc.)
256
+
- Use component-specific prefixes: `package.card.*`, `settings.*`, `nav.*`
257
+
258
+
### Using i18n-ally (recommended)
259
+
260
+
We recommend the [i18n-ally](https://marketplace.visualstudio.com/items?itemName=lokalise.i18n-ally) VSCode extension for a better development experience:
261
+
262
+
- Inline translation previews in your code
263
+
- Auto-completion for translation keys
264
+
- Missing translation detection
265
+
- Easy navigation to translation files
266
+
267
+
The extension is included in our workspace recommendations, so VSCode should prompt you to install it.
268
+
269
+
### Adding a new locale
270
+
271
+
1. Create a new JSON file in `i18n/locales/` (e.g., `fr.json`)
Copy file name to clipboardExpand all lines: README.md
+12Lines changed: 12 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,6 +18,18 @@ The aim of [npmx.dev](https://npmx.dev) is to provide a better browser for the n
18
18
-**URL compatible**– Replace `npmjs.com` with `xnpmjs.com` or `npmx.dev` in any URL and it just works.
19
19
-**Simplicity**– No noise, cluttered display, or confusing UI. If in doubt: choose simplicity.
20
20
21
+
## Shortcuts
22
+
23
+
> [!IMPORTANT]
24
+
> We're keeping the website, repository, and our discord community low-profile until the browser is polished enough. We'll do a formal announcement at that point. Please avoid sharing the website or the invite link to discord on social media directly. The repo is public, so people who care about the project can easily find it and join us. Anyone who wants to help is more than welcome to [join the community](https://chat.npm.dev). If you know others who would be interested, please invite them too!
25
+
26
+
-[chat.npmx.dev](https://chat.npmx.dev) - Discord Server
0 commit comments