Closed dsvgl closed 1 year ago
Related to #1804 now in SSG html there's language file string name
I've just fixed this issue. You can try to use edge version
Thanks!
Same problem here "@nuxtjs/i18n": "8.0.0-beta.8"
i18n: {
baseUrl: 'https://next.naeko.moe',
strategy: 'prefix_except_default',
lazy: true,
langDir: 'locales/',
defaultLocale: 'es',
detectBrowserLanguage: {
alwaysRedirect: true,
fallbackLocale: 'es',
},
locales: [
{
code: 'es',
name: 'Español',
file: 'es.json',
},
],
vueI18n: {
locale: 'es',
legacy: false,
},
},
@kazupon any idea? The page is SSG.
@kaname-png try edge version. There, it works for me.
Same problem here
"@nuxtjs/i18n": "8.0.0-beta.8"
i18n: { baseUrl: 'https://next.naeko.moe', strategy: 'prefix_except_default', lazy: true, langDir: 'locales/', defaultLocale: 'es', detectBrowserLanguage: { alwaysRedirect: true, fallbackLocale: 'es', }, locales: [ { code: 'es', name: 'Español', file: 'es.json', }, ], vueI18n: { locale: 'es', legacy: false, }, },
Remove the / from langDir, just 'locales'
Same problem here
"@nuxtjs/i18n": "8.0.0-beta.8"
i18n: { baseUrl: 'https://next.naeko.moe', strategy: 'prefix_except_default', lazy: true, langDir: 'locales/', defaultLocale: 'es', detectBrowserLanguage: { alwaysRedirect: true, fallbackLocale: 'es', }, locales: [ { code: 'es', name: 'Español', file: 'es.json', }, ], vueI18n: { locale: 'es', legacy: false, }, },
Remove the / from langDir, just 'locales'
If I remove it, the lazy option asks me for it.
@kaname-png try edge version. There, it works for me.
What is the Edge version?
@kaname-png try edge version. There, it works for me.
What is the Edge version?
Having the exact same issue, even after installing edge version.
https://stackblitz.com/edit/github-us1wuk?file=nuxt.config.ts
@urbgimtam
Hi!
Could you try to re-install from clean (rm -rf node_modules package-lock.json
) please? 🙏
I've just tried to download your repo and re-install, so I could not reproduce hydration miss-match. I think it has already fixed in the latest edge version
I confirm, in my 3 installations problem is solved
@urbgimtam Hi! Could you try to re-install from clean (
rm -rf node_modules package-lock.json
) please? 🙏I've just tried to download your repo and re-install, so I could not reproduce hydration miss-match. I think it has already fixed in the latest edge version
Any way to solve this?
i18n: {
baseUrl: 'https://next.naeko.moe',
defaultLocale: 'en',
strategy: 'prefix_except_default',
langDir: 'locales',
lazy: true,
locales: [
{
name: 'English',
code: 'en',
iso: 'en-US',
file: 'en.json',
},
{
name: 'Español',
code: 'es',
file: 'es.json',
iso: 'es-ES',
},
],
detectBrowserLanguage: {
alwaysRedirect: true,
redirectOn: 'all',
cookieKey: 'neko-lang',
},
},
@kaname-png
have you tried a clean install like mentioned above?
rm -rf node_modules package-lock.json
I also got the example from @urbgimtam working with this approach. See this forked Stackblitz with newly created lock file: https://stackblitz.com/edit/github-us1wuk-bsbjoa?file=package.json
@dsvgl Same problem. :( The cookie is not set by default and also shows the flash of switching from English to Spanish (current browser language) on SSG pages (as I showed in the previous video).
What version do you use? I'm on beta9 now and there everything works as expected, maybe try that? But edge should work as well
Hi,
i am using "@nuxtjs/i18n": "npm:@nuxtjs/i18n-edge" in my nuxt project. Nuxt 3.4.1, ssr true.
I am using dynamic language files: de.de.js:
export default defineI18nLocale(async (context, locale) => { const keys = await useFetchTranslations(); return keys.value })
This causes Hydration mismatch errors. All text strings are not rendered on server. Is there a fix for this?
setting lazy: false
was the fix for me
setting
lazy: false
was the fix for me
Instead of this workaround, upgrading to "@nuxtjs/i18n": "8.1.1" fixes it.
Edge fixed the issue too!
Environment
Darwin
v16.17.1
3.0.0
1.0.0
pnpm@7.25.1
vite
modules
,i18n
@nuxtjs/i18n@8.0.0-beta.8-27906685.5bd81af
Build Modules:
-
Reproduction
https://stackblitz.com/edit/github-gfwhki?file=nuxt.config.ts
Describe the bug
I previously was on this edge version where it worked fine:
8.0.0-beta.7-27893843.b72135e
.After updating to latest beta.8 or even latest edge, I get the following warning in browser console:
In the app.vue I display a locale variable. When refreshing the page, you can see that it briefly displays the name of the key and then changes to display the actual (correct) value.
In server console it logs
[intlify] Not found 'homepage' key in 'de' locale messages.
Additional context
This doesn't happen with
ssr: false
.Logs
No response