Ignoring Localized Routes
'no_prefix'strategy unless you're also using differentDomains.If you'd like some pages to be available in some languages only, you can configure the list of supported languages to override the global settings. The options can be specified within either the page components themselves or globally, within the module configuration.
definePageMeta() examples work in all customRoutes modes, the defineI18nRoute() and pages examples require customRoutes to be set to 'page' (default) or 'config' respectively.Pick localized routes
// pages/about.vue
<script setup>
definePageMeta({
i18n: { locales: ['fr', 'es'] }
})
</script>
// pages/about.vue
<script setup>
defineI18nRoute({
locales: ['fr', 'es']
})
</script>
i18n: {
customRoutes: 'config',
pages: {
about: {
en: false,
}
}
}
Disable localized routes
// pages/about.vue
<script setup>
definePageMeta({ i18n: false })
</script>
// pages/about.vue
<script setup>
defineI18nRoute(false)
</script>
i18n: {
customRoutes: 'config',
pages: {
about: false
}
}
What disabling changes
Disabling turns off route localization for the page, not i18n itself — the page is still part of the app and keeps using the active locale:
- The page mounts at its plain path only (
/about), no per-locale variants (/fr/about) are generated. A page with nested children disables its whole subtree. - Translations keep working.
$t(),useI18n(),<i18n-t>and lazy-loaded messages render in the locale that is active when the page is visited. - Navigating to the page from a localized one keeps the current locale, and
setLocale()switches locale in place without changing the URL. localePath(),<NuxtLinkLocale>and the other routing helpers still resolve other pages to their localized paths.
What no longer applies to the page:
- It is never redirected to a prefixed variant, including by browser language detection.
switchLocalePath()returns an empty string for it, since there is no localized route to switch to. A language switcher built on it renders no links here — usesetLocale()instead.useLocaleHead()emits nohreflangalternate links,canonicalorog:urlfor it, as the page has a single URL shared by every locale. Thelanganddirattributes are still set.
detectBrowserLanguage.redirectOn: 'root', a locale is only detected on the root path, so opening such a page directly renders it in the default locale instead of the visitor's. Set redirectOn to 'no prefix' or 'all' to have the cookie or browser locale apply on these pages as well.Disable a group of routes
The i18n route meta is also read from routes set up in the pages:extend hook, which lets you disable localized routes for an entire section of the app — such as an authenticated area that does not need indexable per-locale URLs — without editing each page:
export default defineNuxtConfig({
hooks: {
'pages:extend'(pages) {
for (const page of pages) {
if (page.path === '/login' || page.path === '/account' || page.path.startsWith('/account/')) {
page.meta ??= {}
page.meta.i18n = false
}
}
}
}
})
experimental.scanPageMeta: 'after-resolve', routes are localized in the pages:resolved hook, so meta set in any pages:extend hook is picked up. With scanPageMeta: true, localization runs in pages:extend itself and only hooks registered earlier are, these include the hooks in nuxt.config and those of modules listed before @nuxtjs/i18n.See Custom Paths for the other values this route meta accepts.