Closed major697 closed 3 years ago
Vue ver: 2.6.12 vue-i18n ver: 8.22.2 intlify/vue-i18n-loader ver: 1.0.0
I added to vue.config.js configuration:
vue.config.js
chainWebpack: config => { config.module .rule('i18n') .resourceQuery(/blockType=i18n/) .type('javascript/auto') .use('i18n') .loader('@intlify/vue-i18n-loader') }
Next I added to main.js library vue-i18n:
vue-i18n
import VueI18n from 'vue-i18n' import { languages } from '@/locales' Vue.use(VueI18n) const i18n = new VueI18n({ locale: 'en', fallbackLocale: 'en', silentTranslationWarn: true, messages: Object.assign(languages), }) new Vue({ el: '#app', i18n, components: { App, }, template: '<App/>', })
I have too languages object with translation word:
languages
{ "hi": "hi translate...", }
Next I added to my component word to translate:
<template> <div> <div>{{ $t('hi') }}</div> <div>{{ $t('hello') }}</div> </div> </template> <i18n> { "en": { "hello": "hello translate..." }, } </i18n>
When I trying translate word 'hi' everything work correctly, but when I try translate word 'hello' then nothing isn't translated
When I check language in component I get en:
created() { console.log(this.$i18n.locale) // en },
Not working translate from tag <i18n>
<i18n>
Thank you for your reporting! Unfortunataly, I could not reproduce. Could you provide minimum reproducion code please?
try to use legacy: true in const i18n = new VueI18n({})
legacy: true
const i18n = new VueI18n({})
close due to in-activity
I added to
vue.config.js
configuration:Next I added to main.js library
vue-i18n
:I have too
languages
object with translation word:Next I added to my component word to translate:
When I trying translate word 'hi' everything work correctly, but when I try translate word 'hello' then nothing isn't translated
When I check language in component I get en:
Not working translate from tag
<i18n>