question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fallback does not fallbacks if locale option is an empty string

See original GitHub issue

vue & 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:closed
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
PeterAlfredLeecommented, Feb 1, 2021

@kazupon

Could you fix this issue? 🙏

Glad to help, just push #330 to fix this issue, and add a test.

I’ve been busy lately preparing my speak slides for Vuejs Amsterdam.

Cheers, look forward to your speech!

0reactions
kazuponcommented, Jan 30, 2021

@PeterAlfredLee

@kazupon I’m wonder why we check '' in this code, should we remove it ?

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. 😓

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found