Skip to content

Commit af9007f

Browse files
authored
feat(marketplace): add nuxt-i18n plugin to marketplace (#117)
* feat(marketplace): add nuxt-i18n plugin with generated skills Generate agent skills from @nuxtjs/i18n official documentation (https://i18n.nuxtjs.org/llms-full.txt) covering routing strategies, lazy-loaded translations, SEO, browser detection, and multi-domain setups. * chore: add nuxt-i18n to release-please config * fix(nuxt-i18n): remove duplicate skills dir and fix doc issues - Remove orphaned skills/nuxt-i18n/ directory (canonical location is plugins/nuxt-i18n/.agents/skills/) - Fix customRoutes type to include 'page' as valid value - Clarify useLocaleHead() returns Ref in SEO examples * docs(nuxt-i18n): add llms-full.txt reference link to SKILL.md * chore(nuxt-i18n): apply AI code review suggestions - Change author to Nuxt Community for proper upstream attribution - Clarify named routes guidance to include NuxtLinkLocale
1 parent 363c6e7 commit af9007f

15 files changed

Lines changed: 1165 additions & 0 deletions

.claude-plugin/marketplace.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,14 @@
341341
"tags": ["google", "workspace"],
342342
"source": "./plugins/google-workspace"
343343
},
344+
{
345+
"name": "nuxt-i18n",
346+
"description": "Nuxt i18n internationalization module for locale routing, lazy-loaded translations, SEO, browser detection, and multi-domain setups",
347+
"category": "framework",
348+
"keywords": ["nuxt-i18n", "i18n", "internationalization", "vue-i18n", "localization"],
349+
"tags": ["framework", "vue"],
350+
"source": "./plugins/nuxt-i18n"
351+
},
344352
{
345353
"name": "nuxt-seo",
346354
"description": "Nuxt SEO meta-module with robots, sitemap, og-image, schema-org. Use when configuring SEO, generating sitemaps, creating OG images, or adding structured data.",

.release-please-manifest.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"plugins/slack-agent": "1.0.0",
3030
"plugins/neo4j": "1.0.0",
3131
"plugins/google-workspace": "1.0.0",
32+
"plugins/nuxt-i18n": "1.0.0",
3233
"plugins/nuxt-seo": "1.0.0",
3334
"plugins/markitdown": "1.0.0",
3435
"plugins/ast-grep": "1.0.0",
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Generation Info
2+
3+
- **Source:** `https://i18n.nuxtjs.org/llms-full.txt`
4+
- **Generated:** 2026-03-28
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
name: nuxt-i18n
3+
description: Nuxt i18n internationalization module for locale routing, lazy-loaded translations, SEO, browser detection, and multi-domain setups. Use when working with @nuxtjs/i18n, locale switching, translated routes, or i18n composables.
4+
metadata:
5+
author: Minsu Lee
6+
version: "2026.3.28"
7+
source: Generated from https://i18n.nuxtjs.org/llms-full.txt
8+
---
9+
10+
Nuxt i18n is an internationalization module for Nuxt powered by Vue i18n. It provides locale-based routing, lazy-loaded translations, browser language detection, SEO metadata, and multi-domain locale support.
11+
12+
> The skill is based on @nuxtjs/i18n v10.x, generated at 2026-03-28.
13+
14+
## Core
15+
16+
| Topic | Description | Reference |
17+
|-------|-------------|-----------|
18+
| Configuration | Module setup, locales, Vue I18n config, key options | [core-configuration](references/core-configuration.md) |
19+
| Routing | Strategies, custom route paths, ignoring localized routes | [core-routing](references/core-routing.md) |
20+
21+
## Features
22+
23+
| Topic | Description | Reference |
24+
|-------|-------------|-----------|
25+
| Detection & Switching | Browser detection, lang switcher, locale fallback, cookies | [features-detection-switching](references/features-detection-switching.md) |
26+
| SEO | useLocaleHead, hreflang, canonical links, OpenGraph | [features-seo](references/features-seo.md) |
27+
| Lazy Loading | Lazy-loaded translations, multiple files, dynamic API loading | [features-lazy-loading](references/features-lazy-loading.md) |
28+
| Per-Component | i18n custom blocks in SFCs, local scope translations | [features-per-component](references/features-per-component.md) |
29+
30+
## Advanced
31+
32+
| Topic | Description | Reference |
33+
|-------|-------------|-----------|
34+
| Domains | Different domains, multi-domain locales, runtime env vars | [advanced-domains](references/advanced-domains.md) |
35+
| Server & Hooks | Server-side translations, runtime hooks, module integration, layers | [advanced-server-hooks](references/advanced-server-hooks.md) |
36+
37+
## API
38+
39+
| Topic | Description | Reference |
40+
|-------|-------------|-----------|
41+
| API Reference | Composables, components, helper functions, instance properties | [api-reference](references/api-reference.md) |
42+
43+
## Full Documentation
44+
45+
For details beyond these references, fetch the complete official documentation:
46+
47+
- **llms.txt** (overview): https://i18n.nuxtjs.org/llms.txt
48+
- **llms-full.txt** (full docs): https://i18n.nuxtjs.org/llms-full.txt
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
---
2+
name: domains
3+
description: Different domains and multi-domain locale setups with runtime env overrides in Nuxt i18n
4+
---
5+
6+
# Domain-Based Locales
7+
8+
## Different Domains
9+
10+
Map each locale to its own domain:
11+
12+
```ts [nuxt.config.ts]
13+
export default defineNuxtConfig({
14+
i18n: {
15+
differentDomains: true,
16+
locales: [
17+
{ code: 'en', domain: 'mydomain.com' },
18+
{ code: 'es', domain: 'es.mydomain.com' },
19+
{ code: 'fr', domain: 'fr.mydomain.com' }
20+
]
21+
}
22+
})
23+
```
24+
25+
Use `<a>` tags (not `<NuxtLink>`) for cross-domain switching:
26+
27+
```vue
28+
<template>
29+
<a v-for="loc in availableLocales" :href="switchLocalePath(loc.code)" :key="loc.code">
30+
{{ loc.code }}
31+
</a>
32+
</template>
33+
```
34+
35+
**Shared domains** — multiple languages on one domain with `domainDefault: true`:
36+
37+
```ts
38+
locales: [
39+
{ code: 'en', domain: 'mydomain.com', domainDefault: true },
40+
{ code: 'pl', domain: 'mydomain.com' },
41+
{ code: 'fr', domain: 'fr.mydomain.com', domainDefault: true }
42+
]
43+
```
44+
45+
**Runtime env overrides** (no rebuild needed):
46+
47+
```shell
48+
NUXT_PUBLIC_I18N_DOMAIN_LOCALES_UK_DOMAIN=uk.example.test
49+
NUXT_PUBLIC_I18N_DOMAIN_LOCALES_FR_DOMAIN=fr.example.test
50+
```
51+
52+
**Caching** — use `cache.varies: ['host']` in route rules to prevent cross-domain cache pollution:
53+
54+
```ts [nuxt.config.ts]
55+
routeRules: {
56+
'/': { swr: 60, cache: { varies: ['host'] } }
57+
}
58+
```
59+
60+
## Multi-Domain Locales
61+
62+
All locales available on all domains, with per-domain defaults:
63+
64+
```ts [nuxt.config.ts]
65+
const i18nDomains = ['mydomain.com', 'es.mydomain.com', 'fr.mydomain.com']
66+
67+
export default defineNuxtConfig({
68+
i18n: {
69+
multiDomainLocales: true,
70+
locales: [
71+
{ code: 'en', domains: i18nDomains, defaultForDomains: ['mydomain.com'] },
72+
{ code: 'es', domains: i18nDomains, defaultForDomains: ['es.mydomain.com'] },
73+
{ code: 'fr', domains: i18nDomains, defaultForDomains: ['fr.mydomain.com'] },
74+
{ code: 'nl', domains: i18nDomains },
75+
{ code: 'de', domains: i18nDomains }
76+
]
77+
}
78+
})
79+
```
80+
81+
One locale can be default on multiple domains:
82+
83+
```ts
84+
{ code: 'en', domains: i18nDomains, defaultForDomains: ['mydomain.com', 'en.mydomain.com'] }
85+
```
86+
87+
<!--
88+
Source references:
89+
- https://i18n.nuxtjs.org/docs/guide/different-domains
90+
- https://i18n.nuxtjs.org/docs/guide/multi-domain-locales
91+
-->
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
---
2+
name: server-hooks
3+
description: Server-side translations, runtime hooks, module integration, layers, and extending messages in Nuxt i18n
4+
---
5+
6+
# Server-Side, Hooks & Module Integration
7+
8+
## Runtime Hooks
9+
10+
### `i18n:beforeLocaleSwitch`
11+
12+
Called before locale switch. Can override the new locale by modifying `options.newLocale`:
13+
14+
```ts [plugins/i18n.ts]
15+
export default defineNuxtPlugin((nuxtApp) => {
16+
nuxtApp.hook('i18n:beforeLocaleSwitch', (options) => {
17+
console.log('switching from', options.oldLocale, 'to', options.newLocale)
18+
// Override: force redirect to 'en' instead of 'fr'
19+
if (options.newLocale === 'fr') {
20+
options.newLocale = 'en'
21+
}
22+
})
23+
})
24+
```
25+
26+
Parameters: `oldLocale`, `newLocale` (mutable), `initialSetup` (true on app load).
27+
28+
### `i18n:localeSwitched`
29+
30+
Called after locale switch completes:
31+
32+
```ts [plugins/i18n.ts]
33+
export default defineNuxtPlugin((nuxtApp) => {
34+
nuxtApp.hook('i18n:localeSwitched', ({ oldLocale, newLocale }) => {
35+
console.log('switched from', oldLocale, 'to', newLocale)
36+
})
37+
})
38+
```
39+
40+
## Server-Side Translations (Experimental)
41+
42+
### Locale Detector
43+
44+
```ts [i18n/localeDetector.ts]
45+
export default defineI18nLocaleDetector((event, config) => {
46+
const query = tryQueryLocale(event, { lang: '' })
47+
if (query) return query.toString()
48+
49+
const cookie = tryCookieLocale(event, { lang: '', name: 'i18n_locale' })
50+
if (cookie) return cookie.toString()
51+
52+
const header = tryHeaderLocale(event, { lang: '' })
53+
if (header) return header.toString()
54+
55+
return config.defaultLocale
56+
})
57+
```
58+
59+
```ts [nuxt.config.ts]
60+
export default defineNuxtConfig({
61+
i18n: {
62+
experimental: { localeDetector: 'localeDetector.ts' }
63+
}
64+
})
65+
```
66+
67+
### `useTranslation()` in Event Handlers
68+
69+
```ts [server/api/hello.ts]
70+
export default defineEventHandler(async (event) => {
71+
const t = await useTranslation(event)
72+
return { hello: t('hello') }
73+
})
74+
```
75+
76+
## Extending Messages (Module Authors)
77+
78+
Use `i18n:registerModule` hook to provide translations from a Nuxt module:
79+
80+
```ts [my-module/module.ts]
81+
import { createResolver, defineNuxtModule } from '@nuxt/kit'
82+
83+
export default defineNuxtModule({
84+
async setup(options, nuxt) {
85+
const { resolve } = createResolver(import.meta.url)
86+
nuxt.hook('i18n:registerModule', (register) => {
87+
register({
88+
langDir: resolve('./lang'),
89+
locales: [
90+
{ code: 'en', file: 'en.json' },
91+
{ code: 'fr', file: 'fr.json' }
92+
]
93+
})
94+
})
95+
}
96+
})
97+
```
98+
99+
**Prefix module messages** — main project messages always override module-provided ones.
100+
101+
## Module Integration
102+
103+
Declare dependency on Nuxt i18n with `moduleDependencies`:
104+
105+
```ts [my-module/module.ts]
106+
import { createResolver, defineNuxtModule } from '@nuxt/kit'
107+
const resolver = createResolver(import.meta.url)
108+
109+
export default defineNuxtModule({
110+
moduleDependencies: {
111+
'@nuxtjs/i18n': {
112+
defaults: {
113+
vueI18n: resolver.resolve('./i18n.config.ts'),
114+
langDir: resolver.resolve('./lang'),
115+
locales: [
116+
{ code: 'en', file: resolver.resolve('./lang/en.json') },
117+
{ code: 'fr', file: resolver.resolve('./lang/fr.json') }
118+
]
119+
}
120+
}
121+
}
122+
})
123+
```
124+
125+
## Layers
126+
127+
Nuxt i18n merges i18n configuration from all extended layers. Earlier items in `_layers` have higher priority (user project is always first).
128+
129+
```ts [nuxt.config.ts]
130+
export default defineNuxtConfig({
131+
extends: ['my-layer'],
132+
i18n: {
133+
locales: [{ code: 'en', file: 'en.json' }] // overrides layer's 'en' translations
134+
}
135+
})
136+
```
137+
138+
Pages from extended layers automatically get i18n support. Route configs from each layer merge according to priority.
139+
140+
<!--
141+
Source references:
142+
- https://i18n.nuxtjs.org/docs/guide/runtime-hooks
143+
- https://i18n.nuxtjs.org/docs/guide/server-side-translations
144+
- https://i18n.nuxtjs.org/docs/guide/extending-messages
145+
- https://i18n.nuxtjs.org/docs/guide/module-integration
146+
- https://i18n.nuxtjs.org/docs/guide/layers
147+
-->

0 commit comments

Comments
 (0)