i18n
i18n copied to clipboard
Infinite reload with differentDomains: true
Version
@nuxtjs/i18n: 8.0.0-alpha.3 nuxt: 3.0.0-rc.11
Nuxt configuration
- [ ] Applies to a site deployed to a static server (site generated with
nuxt generate) - [x] Applies to a site deployed to a server with a Node backend
@nuxtjs/i18n configuration
i18n: {
locales: [
{
code: 'en',
domain: mydomain.com
},
{
code: 'fr',
domain: mydomain.fr
}
],
differentDomains: true,
defaultLocale: 'fr',
vueI18n: {
legacy: false,
locale: 'fr',
messages: {
en: {
welcome: 'Welcome'
},
fr: {
welcome: 'Bienvenue'
}
}
}
}
Steps to reproduce
I use pm2 to manage the app execution. Set differentDomains: true in i18n config, run yarn build, and launch app with pm2. Access the app via FR or EN domain, the refresh loop begins. When differentDomains is set to false, the issue doesn't appear. In the doc I see "// TODO: 🚧 This feature is not implemented yet.", but it seems working because when I access app with FR or EN domain, my content is in correct language, but the refresh loop make the UI unusable.
Thanks.
detectBrowserLanguage: false can help you until they will fix
Unfortunately, this setting doesn't change anything, refresh loop persists.
Seeing the same thing - already have detectBrowserLanguage: false
sorry, for late reply.
Unfortunately, I could not reproduce this issue in v8.0.0-beta.2 😞 Could you give us to your reproduction repo with github repo or stackblitz please? 🙏 And We hope you would like to try to use v8.0.0-beta.2, wheather this issue will be reproduced
@kazupon still seeing this in beta 3
This is my config:
i18n: {
strategy: 'no_prefix',
differentDomains: true,
detectBrowserLanguage: false,
baseUrl: process.env.LOCALE === 'de' ? process.env.SITEURL_DE : process.env.SITEURL,
locales: [
{
name: 'nederlands',
code: 'nl',
iso: 'nl-NL',
file: 'nl.json',
domain: process.env.SITEURL,
},
{
name: 'deutsch',
code: 'de',
iso: 'de-DE',
file: 'de.json',
domain: process.env.SITEURL_DE,
},
],
langDir: 'assets/i18n/',
defaultLocale: process.env.LOCALE,
lazy: true,
},
Same problem
@boboldehampsink Thank you for your feedback! I could reproduce loop redirection. I'll try to fix this issue.
This is my config.
Doesn't work with both detectBrowserLanguage: {...} and detectBrowserLanguage: false
export default defineNuxtConfig({
modules: ['@nuxtjs/i18n'],
i18n: {
locales: [
{
code: 'en',
domain: 'mysite.test:3000',
},
{
code: 'de',
domain: 'mysite.testde:3000',
},
],
trailingSlash: true,
differentDomains: true,
defaultLocale: 'en',
strategy: 'prefix_and_default',
detectBrowserLanguage: false,
// detectBrowserLanguage: {
// useCookie: false,
// redirectOn: 'root',
// fallbackLocale: 'en',
// // alwaysRedirect: true,
// },
vueI18n: {
legacy: false,
messages: {
en: {
welcome: 'Welcome',
},
de: {
welcome: 'Willkommen',
},
},
},
},
})
I've just released @nuxtjs/[email protected] edge version
I believe this issue is fixed.
you can try to use it.
I just tested your release, but refresh loop is always here for me.
Thank you @kazupon It works perfectly
Will you port this to @nuxtjs/i18n?
@maxsolovev what is your config? Same as above? For me the redirect loop persists.
Yes, it's same. But there were problems with routing. screencast