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

Default locale should be loaded from main bundle #818

Closed
rchl opened this issue Aug 2, 2020 · 2 comments · Fixed by #819
Closed

Default locale should be loaded from main bundle #818

rchl opened this issue Aug 2, 2020 · 2 comments · Fixed by #819
Labels

Comments

@rchl
Copy link
Collaborator

rchl commented Aug 2, 2020

If the user has specified defaultLocale and is using lazy option to load messages, the lang file for default locale should be loaded from the main bundle as it's always needed (either for the current locale or to be used as fallback).

This was brought up in both #486 and #815.

@rchl rchl added the bug 🐛 label Aug 2, 2020
rchl added a commit that referenced this issue Aug 2, 2020
This avoid extra request for the locale that is always needed anyway.

Resolves #818
@koteezy
Copy link

koteezy commented Aug 2, 2020

What if the user's language doesn't match defaulLocale, in this case, in main.bundle will find the unnecessary language.

Maybe we should inject JSON with current user language to the page via nuxtState, this way you can avoid an unnecessary Ajax request.

@rchl
Copy link
Collaborator Author

rchl commented Aug 3, 2020

Even if the user's locale is not the default locale, the default locale is needed as it's loaded as a fallback. So there are still benefits to having it in the main bundle.

Maybe we should inject JSON with current user language to the page via nuxtState

This is a possible further, separate improvement.

@rchl rchl closed this as completed in #819 Aug 3, 2020
rchl added a commit that referenced this issue Aug 3, 2020
This avoid extra request for the locale that is always needed anyway.

Resolves #818
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants