I am using nuxt-i18n to translate my page, but it can't find translation strings.
My setup:
modules: [
[
'nuxt-i18n', {
locales: [
{
code: 'en',
name: 'English',
iso: 'en-US',
langFile: 'en_US.js',
},
{
code: 'pt',
name: 'Português',
iso: 'pt-BR',
langFile: 'pt_BR.js',
},
],
loadLanguagesAsync: true,
langDir: 'locales/',
defaultLocale: 'en',
},
],
],
export default {
Greeting: 'Hello',
Sign_up: 'Sign up',
};
{{ $t('Greeting') }}
WARN [vue-i18n] Cannot translate the value of keypath 'Login'. Use the value of keypath as default.
The warning says it all - you don't have the Login message defined in the en_US.js file.
Somewhere in your app you're certainly calling {{ $t('Login') }}
.
The solution is setting a lazy property value to true. Below is the code snippet.
modules: [
[
'nuxt-i18n', {
lazy:true,
locales: [
{
code: 'en',
name: 'English',
iso: 'en-US',
langFile: 'en_US.js',
},
{
code: 'pt',
name: 'Português',
iso: 'pt-BR',
langFile: 'pt_BR.js',
},
],
loadLanguagesAsync: true,
langDir: 'locales/',
defaultLocale: 'en',
},
],
]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With