BraindeadDogge
BraindeadDogge
NNuxt
Created by BraindeadDogge on 5/19/2024 in #❓・help
I18N problem
Hi, i'm having a problem with i18n config in my project. So, here how it looks like:
export default defineI18nConfig(() => ({
lazy: true,
langDir: "lang",
strategy: 'prefix_except_default',
defaultLocale: 'ru',
fallbackLocale: 'ru',
silentFallbackWarn: true,
warnHtmlInMessage: 'off',
locales: [
{ code: 'ru', iso: 'ru-RU', name: "RU", file: 'ru-RU.json' },
{ code: 'en', iso: 'en-US', name: "EN", file: 'en-US.json' },
],
detectBrowserLanguage: {
useCookie: true,
cookieKey: 'i18n_redirected',
redirectOn: 'root',
alwaysRedirect: true
}
}))
export default defineI18nConfig(() => ({
lazy: true,
langDir: "lang",
strategy: 'prefix_except_default',
defaultLocale: 'ru',
fallbackLocale: 'ru',
silentFallbackWarn: true,
warnHtmlInMessage: 'off',
locales: [
{ code: 'ru', iso: 'ru-RU', name: "RU", file: 'ru-RU.json' },
{ code: 'en', iso: 'en-US', name: "EN", file: 'en-US.json' },
],
detectBrowserLanguage: {
useCookie: true,
cookieKey: 'i18n_redirected',
redirectOn: 'root',
alwaysRedirect: true
}
}))
And for some reason i keep getting these warnings:
WARN [intlify] Not found 'header.company' key in 'en' locale messages.


WARN [intlify] Fall back to translate 'header.company' key with 'ru' locale.


WARN [intlify] Not found 'header.company' key in 'ru' locale messages.
WARN [intlify] Not found 'header.company' key in 'en' locale messages.


WARN [intlify] Fall back to translate 'header.company' key with 'ru' locale.


WARN [intlify] Not found 'header.company' key in 'ru' locale messages.
But if i would pass same config not in i18n.config.ts, but in nuxt.config.js just by object, everything works perfectly fine. The only reason i have to use i18n.config.ts but not the main config is because i need to use html inside by locales, which i can only allow with warnHtmlInMessage key, which doesn't work if you pass it in nuxt.config.ts
7 replies