Different domains with multiple languages each
See original GitHub issueI am not a 100% sure if this really isn’t possible yet, but it seems like it isn’t. We have multiple TLD’s and one of them (.ch) needs to have two languages which should result in the following domain/path/locale combinations:
- weekend4two.ch
de-CH
- weekend4two.ch/fr
fr-CH
- weekend4two.de
de-DE
- weekend4two.at
de-AT
- weekend4two.fr/fr OR weekend4two.fr
fr-FR
(We do not really care since the .fr TLD does only need one language)
I’ve tried a few configs to achieve what I need but had no success. This one was the closest:
/* nuxt.config.js */
...
i18n: {
differentDomains: true,
strategy: 'prefix_except_default',
locales: [
{
code: 'de-CH',
iso: 'de-CH',
domain: 'weekend4two.ch',
},
{
code: 'fr-CH',
iso: 'fr-CH',
domain: 'weekend4two.ch',
},
{
code: 'fr-FR',
iso: 'fr-FR',
domain: 'weekend4two.fr',
},
{
code: 'de-DE',
iso: 'de-DE',
domain: 'weekend4two.de',
},
{
code: 'de-AT',
iso: 'de-AT',
domain: 'weekend4two.at',
},
],
}
...
/* index.vue */
...
<script>
export default {
nuxtI18n: {
paths: {
de: '/',
fr: '/fr',
'fr-CH': '/fr',
},
},
}
</script>
...
The seems to result in a working solution where all the domains/path exist. But when going to weekend4two.ch/fr
, the locale is set to de-CH
. Whatever I do, it takes the locale of the first entry with the same domain.
Describe the solution you’d like
It would be cool if the locales config in nuxt.config.js
could be extended with a prefix
property like this:
/* nuxt.config.js */
locales: [
{
code: 'de-CH',
iso: 'de-CH',
domain: 'weekend4two.ch',
prefix: '', /* could be removed too */
},
{
code: 'fr-CH',
iso: 'fr-CH',
domain: 'weekend4two.ch',
prefix: '/fr',
},
...
]
Describe alternatives you’ve considered
I am open to all alternatives. It may be possible that it even is possible in a way I haven’t figured out yet. I am new to NUXT.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:6
- Comments:18
Top GitHub Comments
I face the same requirements. Would be great if the solution provide by @lfglopes could be merged.
I have the same requirements for a page that has multiple locales on each domain. This seems like a common usecase, so would be great if this can get merged!