Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .claude-plugin/marketplace.json
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,14 @@
"tags": ["google", "workspace"],
"source": "./plugins/google-workspace"
},
{
"name": "nuxt-i18n",
"description": "Nuxt i18n internationalization module for locale routing, lazy-loaded translations, SEO, browser detection, and multi-domain setups",
"category": "framework",
"keywords": ["nuxt-i18n", "i18n", "internationalization", "vue-i18n", "localization"],
"tags": ["framework", "vue"],
"source": "./plugins/nuxt-i18n"
},
{
"name": "nuxt-seo",
"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.",
Expand Down
1 change: 1 addition & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"plugins/slack-agent": "1.0.0",
"plugins/neo4j": "1.0.0",
"plugins/google-workspace": "1.0.0",
"plugins/nuxt-i18n": "1.0.0",
"plugins/nuxt-seo": "1.0.0",
"plugins/markitdown": "1.0.0",
"plugins/ast-grep": "1.0.0",
Expand Down
4 changes: 4 additions & 0 deletions plugins/nuxt-i18n/.agents/skills/nuxt-i18n/GENERATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Generation Info

- **Source:** `https://i18n.nuxtjs.org/llms-full.txt`
- **Generated:** 2026-03-28
48 changes: 48 additions & 0 deletions plugins/nuxt-i18n/.agents/skills/nuxt-i18n/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
name: nuxt-i18n
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.
metadata:
author: Minsu Lee
version: "2026.3.28"
source: Generated from https://i18n.nuxtjs.org/llms-full.txt
---

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.

> The skill is based on @nuxtjs/i18n v10.x, generated at 2026-03-28.

## Core

| Topic | Description | Reference |
|-------|-------------|-----------|
| Configuration | Module setup, locales, Vue I18n config, key options | [core-configuration](references/core-configuration.md) |
| Routing | Strategies, custom route paths, ignoring localized routes | [core-routing](references/core-routing.md) |

## Features

| Topic | Description | Reference |
|-------|-------------|-----------|
| Detection & Switching | Browser detection, lang switcher, locale fallback, cookies | [features-detection-switching](references/features-detection-switching.md) |
| SEO | useLocaleHead, hreflang, canonical links, OpenGraph | [features-seo](references/features-seo.md) |
| Lazy Loading | Lazy-loaded translations, multiple files, dynamic API loading | [features-lazy-loading](references/features-lazy-loading.md) |
| Per-Component | i18n custom blocks in SFCs, local scope translations | [features-per-component](references/features-per-component.md) |

## Advanced

| Topic | Description | Reference |
|-------|-------------|-----------|
| Domains | Different domains, multi-domain locales, runtime env vars | [advanced-domains](references/advanced-domains.md) |
| Server & Hooks | Server-side translations, runtime hooks, module integration, layers | [advanced-server-hooks](references/advanced-server-hooks.md) |

## API

| Topic | Description | Reference |
|-------|-------------|-----------|
| API Reference | Composables, components, helper functions, instance properties | [api-reference](references/api-reference.md) |

## Full Documentation

For details beyond these references, fetch the complete official documentation:

- **llms.txt** (overview): https://i18n.nuxtjs.org/llms.txt
- **llms-full.txt** (full docs): https://i18n.nuxtjs.org/llms-full.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
---
name: domains
description: Different domains and multi-domain locale setups with runtime env overrides in Nuxt i18n
---

# Domain-Based Locales

## Different Domains

Map each locale to its own domain:

```ts [nuxt.config.ts]
export default defineNuxtConfig({
i18n: {
differentDomains: true,
locales: [
{ code: 'en', domain: 'mydomain.com' },
{ code: 'es', domain: 'es.mydomain.com' },
{ code: 'fr', domain: 'fr.mydomain.com' }
]
}
})
```

Use `<a>` tags (not `<NuxtLink>`) for cross-domain switching:

```vue
<template>
<a v-for="loc in availableLocales" :href="switchLocalePath(loc.code)" :key="loc.code">
{{ loc.code }}
</a>
</template>
```

**Shared domains** — multiple languages on one domain with `domainDefault: true`:

```ts
locales: [
{ code: 'en', domain: 'mydomain.com', domainDefault: true },
{ code: 'pl', domain: 'mydomain.com' },
{ code: 'fr', domain: 'fr.mydomain.com', domainDefault: true }
]
```

**Runtime env overrides** (no rebuild needed):

```shell
NUXT_PUBLIC_I18N_DOMAIN_LOCALES_UK_DOMAIN=uk.example.test
NUXT_PUBLIC_I18N_DOMAIN_LOCALES_FR_DOMAIN=fr.example.test
```

**Caching** — use `cache.varies: ['host']` in route rules to prevent cross-domain cache pollution:

```ts [nuxt.config.ts]
routeRules: {
'/': { swr: 60, cache: { varies: ['host'] } }
}
```

## Multi-Domain Locales

All locales available on all domains, with per-domain defaults:

```ts [nuxt.config.ts]
const i18nDomains = ['mydomain.com', 'es.mydomain.com', 'fr.mydomain.com']

export default defineNuxtConfig({
i18n: {
multiDomainLocales: true,
locales: [
{ code: 'en', domains: i18nDomains, defaultForDomains: ['mydomain.com'] },
{ code: 'es', domains: i18nDomains, defaultForDomains: ['es.mydomain.com'] },
{ code: 'fr', domains: i18nDomains, defaultForDomains: ['fr.mydomain.com'] },
{ code: 'nl', domains: i18nDomains },
{ code: 'de', domains: i18nDomains }
]
}
})
```

One locale can be default on multiple domains:

```ts
{ code: 'en', domains: i18nDomains, defaultForDomains: ['mydomain.com', 'en.mydomain.com'] }
```

<!--
Source references:
- https://i18n.nuxtjs.org/docs/guide/different-domains
- https://i18n.nuxtjs.org/docs/guide/multi-domain-locales
-->
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
---
name: server-hooks
description: Server-side translations, runtime hooks, module integration, layers, and extending messages in Nuxt i18n
---

# Server-Side, Hooks & Module Integration

## Runtime Hooks

### `i18n:beforeLocaleSwitch`

Called before locale switch. Can override the new locale by modifying `options.newLocale`:

```ts [plugins/i18n.ts]
export default defineNuxtPlugin((nuxtApp) => {
nuxtApp.hook('i18n:beforeLocaleSwitch', (options) => {
console.log('switching from', options.oldLocale, 'to', options.newLocale)
// Override: force redirect to 'en' instead of 'fr'
if (options.newLocale === 'fr') {
options.newLocale = 'en'
}
})
})
```

Parameters: `oldLocale`, `newLocale` (mutable), `initialSetup` (true on app load).

### `i18n:localeSwitched`

Called after locale switch completes:

```ts [plugins/i18n.ts]
export default defineNuxtPlugin((nuxtApp) => {
nuxtApp.hook('i18n:localeSwitched', ({ oldLocale, newLocale }) => {
console.log('switched from', oldLocale, 'to', newLocale)
})
})
```

## Server-Side Translations (Experimental)

### Locale Detector

```ts [i18n/localeDetector.ts]
export default defineI18nLocaleDetector((event, config) => {
const query = tryQueryLocale(event, { lang: '' })
if (query) return query.toString()

const cookie = tryCookieLocale(event, { lang: '', name: 'i18n_locale' })
if (cookie) return cookie.toString()

const header = tryHeaderLocale(event, { lang: '' })
if (header) return header.toString()

return config.defaultLocale
})
```

```ts [nuxt.config.ts]
export default defineNuxtConfig({
i18n: {
experimental: { localeDetector: 'localeDetector.ts' }
}
})
```

### `useTranslation()` in Event Handlers

```ts [server/api/hello.ts]
export default defineEventHandler(async (event) => {
const t = await useTranslation(event)
return { hello: t('hello') }
})
```

## Extending Messages (Module Authors)

Use `i18n:registerModule` hook to provide translations from a Nuxt module:

```ts [my-module/module.ts]
import { createResolver, defineNuxtModule } from '@nuxt/kit'

export default defineNuxtModule({
async setup(options, nuxt) {
const { resolve } = createResolver(import.meta.url)
nuxt.hook('i18n:registerModule', (register) => {
register({
langDir: resolve('./lang'),
locales: [
{ code: 'en', file: 'en.json' },
{ code: 'fr', file: 'fr.json' }
]
})
})
}
})
```

**Prefix module messages** — main project messages always override module-provided ones.

## Module Integration

Declare dependency on Nuxt i18n with `moduleDependencies`:

```ts [my-module/module.ts]
import { createResolver, defineNuxtModule } from '@nuxt/kit'
const resolver = createResolver(import.meta.url)

export default defineNuxtModule({
moduleDependencies: {
'@nuxtjs/i18n': {
defaults: {
vueI18n: resolver.resolve('./i18n.config.ts'),
langDir: resolver.resolve('./lang'),
locales: [
{ code: 'en', file: resolver.resolve('./lang/en.json') },
{ code: 'fr', file: resolver.resolve('./lang/fr.json') }
]
}
}
}
})
```

## Layers

Nuxt i18n merges i18n configuration from all extended layers. Earlier items in `_layers` have higher priority (user project is always first).

```ts [nuxt.config.ts]
export default defineNuxtConfig({
extends: ['my-layer'],
i18n: {
locales: [{ code: 'en', file: 'en.json' }] // overrides layer's 'en' translations
}
})
```

Pages from extended layers automatically get i18n support. Route configs from each layer merge according to priority.

<!--
Source references:
- https://i18n.nuxtjs.org/docs/guide/runtime-hooks
- https://i18n.nuxtjs.org/docs/guide/server-side-translations
- https://i18n.nuxtjs.org/docs/guide/extending-messages
- https://i18n.nuxtjs.org/docs/guide/module-integration
- https://i18n.nuxtjs.org/docs/guide/layers
-->
Loading
Loading