Fallback does not fallbacks if locale option is an empty string
See original GitHub issuevue & vue-i18n version
- vue: 3.0.5
- vue-i18n: 9.0.0-rc.4
Steps to reproduce
Setup i18n in this way:
const i18n = {
locale: '',
fallbackLocale: 'en',
messages: {/* my translations */},
};
createI18n(i18n);
createApp({
...
})
.use(i18n)
.mount('#app');
What is Expected?
Fallback to ‘en’ locale.
What is actually happening?
Displaying messages placeholders.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Empty string causes fallback · Issue #80 · i18next ... - GitHub
It appears having the value for a key as an empty string causes the fallback value to be returned instead. Value returned is...
Read more >Rails I18n fallbacks for hash - Stack Overflow
The fallback works when a key does not exist in a locale. The problem here is that hello exists. I've come across the...
Read more >GetLocalizedString does not return fallback locale string when ...
A StringTable does not support fallbacks, it will always return the entry, even if it is empty. This is intentional as you may...
Read more >Fallback - i18next documentation
Doing graceful fallbacks is a core principle of i18next. This enables you to display the most accurate content possible, while not repeating content...
Read more >Fallback localization | Vue I18n
By default, falling back to fallbackLocale generates two console warnings: [vue-i18n] Value of key 'hello' is not a string! [vue-i18n] Fall back ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@kazupon
Glad to help, just push #330 to fix this issue, and add a test.
Cheers, look forward to your speech!
@PeterAlfredLee
This is bug from v8.x. https://github.com/kazupon/vue-i18n/blob/f78c1fc1f3137935e57735df20aef83f16dd68cf/src/index.js#L569
That should be fallback.
Could you fix this issue? 🙏 I’ve been busy lately preparing my speak slides for Vuejs Amsterdam. 😓