Skip to content

Commit 2e5b804

Browse files
committed
Merge remote-tracking branch 'origin/main' into fix/ssr-repo
2 parents 94d51ca + 762f218 commit 2e5b804

128 files changed

Lines changed: 16412 additions & 2248 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/autofix.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
pull_request:
66
branches:
77
- main
8+
merge_group:
9+
branches:
10+
- main
811

912
permissions:
1013
contents: read

.github/workflows/ci.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ on:
77
push:
88
branches:
99
- main
10+
merge_group:
11+
branches:
12+
- main
1013

1114
permissions:
1215
contents: read
@@ -91,7 +94,7 @@ jobs:
9194
- name: 🏗️ Build project
9295
run: pnpm build
9396

94-
- name: ♿ Accessibility audit (Lighthouse)
95-
run: pnpx @lhci/cli autorun
97+
- name: ♿ Accessibility audit (Lighthouse - dark & light mode)
98+
run: ./scripts/lighthouse-a11y.sh
9699
env:
97100
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}

.github/workflows/provenance.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ on:
77
pull_request:
88
branches:
99
- main
10+
merge_group:
11+
branches:
12+
- main
1013
permissions:
1114
contents: read
1215
jobs:

.lighthouserc.cjs

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
const fs = require('fs')
2+
3+
// Auto-detect Chrome executable path
4+
function findChrome() {
5+
const paths = [
6+
// Linux
7+
'/usr/bin/google-chrome-stable',
8+
'/usr/bin/google-chrome',
9+
'/usr/bin/chromium-browser',
10+
// macOS
11+
'/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
12+
// Windows
13+
'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe',
14+
'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe',
15+
]
16+
17+
for (const p of paths) {
18+
if (fs.existsSync(p)) return p
19+
}
20+
21+
return undefined
22+
}
23+
24+
module.exports = {
25+
ci: {
26+
collect: {
27+
startServerCommand: 'pnpm preview',
28+
startServerReadyPattern: 'Listening',
29+
url: [
30+
'http://localhost:3000/',
31+
'http://localhost:3000/search?q=nuxt',
32+
'http://localhost:3000/nuxt',
33+
],
34+
numberOfRuns: 1,
35+
chromePath: findChrome(),
36+
puppeteerScript: './lighthouse-setup.cjs',
37+
settings: {
38+
onlyCategories: ['accessibility'],
39+
skipAudits: ['valid-source-maps'],
40+
},
41+
},
42+
assert: {
43+
assertions: {
44+
'categories:accessibility': ['error', { minScore: 1 }],
45+
},
46+
},
47+
upload: {
48+
target: 'temporary-public-storage',
49+
},
50+
},
51+
}

.lighthouserc.json

Lines changed: 0 additions & 26 deletions
This file was deleted.

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@jsr:registry=https://npm.jsr.io

.oxfmtignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Docus MDC content - formatter breaks component syntax
2+
docs/content/**/*.md

.vscode/extensions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"recommendations": ["oxc.oxc-vscode", "Vue.volar"]
2+
"recommendations": ["oxc.oxc-vscode", "Vue.volar", "lokalise.i18n-ally"]
33
}

.vscode/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"i18n-ally.localesPaths": ["./i18n/locales"],
3+
"i18n-ally.keystyle": "nested"
4+
}

CONTRIBUTING.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,90 @@ const props = defineProps<{
208208

209209
Ideally, extract utilities into separate files so they can be unit tested. 🙏
210210

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)
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+
<script setup lang="ts">
237+
const message = computed(() => $t('my.translation.key'))
238+
</script>
239+
```
240+
241+
3. For dynamic values, use interpolation:
242+
243+
```json
244+
{ "greeting": "Hello, {name}!" }
245+
```
246+
247+
```vue
248+
<p>{{ $t('greeting', { name: userName }) }}</p>
249+
```
250+
251+
### Translation key conventions
252+
253+
- 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`)
273+
2. Add the locale to `nuxt.config.ts`:
274+
275+
```typescript
276+
i18n: {
277+
locales: [
278+
{ code: 'en', language: 'en-US', name: 'English', file: 'en.json' },
279+
{ code: 'fr', language: 'fr-FR', name: 'Francais', file: 'fr.json' },
280+
],
281+
}
282+
```
283+
284+
3. Translate all keys from `en.json`
285+
286+
### Formatting with locale
287+
288+
When formatting numbers or dates that should respect the user's locale, pass the locale:
289+
290+
```typescript
291+
const { locale } = useI18n()
292+
const formatted = formatNumber(12345, locale.value) // "12,345" in en-US
293+
```
294+
211295
## Testing
212296

213297
### Unit tests

0 commit comments

Comments
 (0)