vux icon indicating copy to clipboard operation
vux copied to clipboard

[vue-i18n] Fall back to translate the keypath 'depo.method' with 'en-US' locale.

Open richdavid opened this issue 7 years ago • 1 comments
trafficstars

[vue-i18n] Fall back to translate the keypath 'depo.method' with 'en-US' locale.

locale zh-CN

image

const i18n = new VueI18n({ locale: cookie.get('lang'), messages: { 'zh-CN': require('./common/lang/cn'), // 中文语言包 'en-US': require('./common/lang/en') // 英文语言包 } })

mounted () {

  if (cookie.get('lang') === '0') {
    this.locale = 'en-US'
    this.lang = '中文'
  } else {
    this.locale = 'zh-CN'
    this.lang = 'ENG'
  }
  cookie.set('lang', this.locale === 'en-US' ? '0' : '1', 1)
},

watch: { locale (val) { this.$i18n.locale = val console.log('locale', val) } }, locale

本地有cookie, 为1,函数是 lang=1的时候,locale是中文,但是它还是返回到用英文。

richdavid avatar Jun 06 '18 06:06 richdavid

你好,请问解决了吗

bigkrys avatar Apr 02 '22 02:04 bigkrys