-
-
Notifications
You must be signed in to change notification settings - Fork 483
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
Preload lang chunks #486
Comments
This is how it works right now with |
Indeed, it's linked to the |
By preload you mean use the preload meta tag? |
Exactly! |
I managed to do it, although I'm not really proud of the solution: In the layout: if (process.client){
import('~/path/to/translations/messages.en_GB.yml')
import(`~/path/to/translations/messages.${__NUXT__.state.layout.locale}.yml`)
} |
I thought I've understood what you were requesting but your last comment has confused me again. Apparently you are not talking about Lazy loading itself is loading all messages for the current locale and fallback locale so I'm not sure what are you missing exactly and how importing those yml files helps you. |
I'll try to be clear enough: Conditions:
What is the problem?
What solutions?
|
Now I understand, thanks :) No idea how to do those things yet but will investigate at some point. :) |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
It's still a relevant issue. To avoid delay or screen flash for users that need the non-english, preload of the native might be preferable first... ))? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Instead of client importing and processing messages (translations) itself on load pass already loaded messages from the server through nuxtState. This will in most cases allow avoiding triggering an extra network request to fetch lang file for given locale. Slight behavior change: The client will no longer import the lang file itself for the initially used locale. That means that if the lang file has exported a function, it will only be called on the server and not the client. This matches behavior of "asyncData" and I think it makes more sense in general. Resolves #486 Resolves #663
Instead of client importing and processing messages (translations) itself on load, pass already loaded messages from the server through "nuxtState". This will in most cases allow avoiding triggering an extra network request to fetch lang file for the given locale. Slight behavior change: The client will no longer import the lang file itself for the initially used locale. That means that if the lang file has exported a function, it will only be called on the server and not on the client. This matches behavior of "asyncData" and I think it makes more sense in general. Resolves #486 Resolves #663
Released in v6.13.3 |
What problem does this feature solve?
Hello,
I'm working on a 30-lang website and it would be great to preload some lang chunks.
Ex:
Btw, is it possible to do so today?
Thanks,
The text was updated successfully, but these errors were encountered: