Compiler Macros
defineI18nRoute
This macro is deprecated in favor of setting localized paths using
See its section in Custom Paths for more details.
definePageMeta() and will be removed in v11.See its section in Custom Paths for more details.
defineI18nRoute() is a compiler macro that you can use to set custom route paths for your page components located in the pages/ directory (unless set otherwise). This way you can set custom route paths for each static or dynamic route of your Nuxt application.
pages/some-page.vue
<script setup>
defineI18nRoute({
paths: {
en: '/about-us',
fr: '/a-propos',
ja: '/about-ja'
}
})
</script>
Type
defineI18nRoute(route: I18nRoute | false) => void
interface I18nRoute {
paths?: Record<Locale, `/${string}`>
locales?: Locale[]
}
Parameters
false
Disable localize for the target page component route.
I18nRoute
An object accepting the following i18n route settings:
paths- Type:
Record<Locale,/${string}>
Customize page component routes per locale. You can specify static and dynamic paths for vue-router.
- Type:
locales- Type:
Locale[]
Some locales to which the page component should be localized.
- Type: