Compiler Macros for Nuxt i18n modul
defineI18nRoutedefineI18nRoute 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.
<script setup>
defineI18nRoute({
paths: {
en: '/about-us',
fr: '/a-propos',
ja: '/about-ja'
}
})
</script>
defineI18nRoute(route: I18nRoute | false) => void
interface I18nRoute {
paths?: Record<string, string>
locales?: string[]
}
falseDisable localize for the target page component route.
I18nRouteAn object accepting the following i18n route settings:
pathsRecord<Locale, string>localesstring[]