Is there way to make language code before route base in Nuxt 2

19 Views Asked by At

I have multilingual Nuxt 2 app which working on URI /catalog as separated part. Here is related parts in my nuxt.config.js:

// Router configuration
router: {
   base: '/catalog',
},

// Localization
i18n: {
    locales: [
        { code: 'en', file: 'en.js' },
        { code: 'de', file: 'de.js' },
    ],
    defaultLocale: 'en',
    lazy: true,
    langDir: '@/locales/',
    detectBrowserLanguage: false
},

As result I have URL's:

sitename.com/catalog --> default EN

sitename.com/catalog/de --> DE code is wrong place for me

How to make next structure of URL and keep current router.base settings:

sitename.com/de/catalog

0

There are 0 best solutions below