airyland / airyland/vux

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

Offen
#2,833 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Vue
Sterne
17.5k
Forks
3.6k
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

[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是中文,但是它还是返回到用英文。

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Start by reproducing the shown VueI18n configuration with the cookie values 0 and 1, the zh-CN/en-US messages, and the `depo.method` keypath. Inspect the mounted hook and locale watcher to determine why zh-CN still resolves through en-US. Done means the selected locale consistently resolves the intended translation without unintended fallback.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
javascript
Bereich
frontend, internationalization
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.