Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fallback locale setting isn't being applied #167

Closed
brandonpittman opened this issue Mar 9, 2020 · 3 comments
Closed

Fallback locale setting isn't being applied #167

brandonpittman opened this issue Mar 9, 2020 · 3 comments

Comments

@brandonpittman
Copy link

The I18n module should fallback to the fallback locale, but it isn't.

locale: 'jp',
fallback: 'en',
messages: {
	en: { hello: 'Hello'},
	jp: {}
}
{{ i18n.hello }} <!-- should be 'Hello' on jp locale -->

In the jp locale, it returns nothing. Am I missing something?

@pikax
Copy link
Owner

pikax commented Mar 9, 2020

That's absolutely correct, there's a bug when the locale is different than the fallback it won't load the fallback.

An hack for that is:

 const { i18n, locale } = useI18n({
      locale: "en", // force it to load the fallback locale
      fallback: "en",
      messages: {
        en: { hello: "Hello" },
        jp: {}
      },
      notFoundFallback: true
    });
   // change to the correct locale
    locale.value = "jp";

that will make it work. I'm working on a fix and I should release in the next few hours.

EDIT: No need for the hack on 1.0.0-dev.15

@pikax pikax closed this as completed in 8c2ee07 Mar 9, 2020
@pikax
Copy link
Owner

pikax commented Mar 9, 2020

This is fixed on 1.0.0-dev.15

@brandonpittman
Copy link
Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants