kazupon/vue-i18n
View on GitHub[feature request] Have $te check for fallback locales
Open
#971 opened on Aug 12, 2020
Status: ProposalType: Featurehelp wanted
Description
Suppose I have the following messages and fallback config:
messages: {
en: {
message: {
hello: 'hello world',
greeting: 'good morning'
}
}
},
fallbackLocale: 'en'
And with my current $i18n.locale set to "en-US", running $te will have the following output:
this.$te('hello') // => false
Would it be a bad idea to configure the default behavior of $te to take into account of the fallback locale setting?
So suppose I have the fallbackLocale set to ['es-EC', 'en'], and with $i18n.locale set to "fr", running
this.$te('hello')
should be equivalent to
(this.$te('hello', 'fr') ||
this.$te('hello', 'es-EC') ||
this.$te('hello', 'es') ||
this.$te('hello', 'en'))
With that implemented, the current default behavior should still be reproduceable with this.$te('hello', this.$i18n.locale).