defineI18nRoute

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) => voidinterface I18nRoute {  paths?: Record<string, string>  locales?: string[]}

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.
  • locales
    • Type: string[]
      Some locales to which the page component should be localized.