airyland / airyland/vux

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

未關閉
#2,833 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Vue
星號
17.5k
分支
3.6k
PR 合併指標
30 天內沒有已合併 PR

描述

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

locale zh-CN

![image](https://user-images.githubusercontent.com/39981752/41020008-cb3db96a-6993-11e8-93cd-c61a1f8a022e.png)

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](https://user-images.githubusercontent.com/39981752/41020080-187d24fe-6994-11e8-9cb3-538d8c96a0b3.png)

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

貢獻指南

這個儲存庫沒有索引到貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。