-
Notifications
You must be signed in to change notification settings - Fork 11
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
Dyn load #139
Merged
Merged
Dyn load #139
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is mostly working, two features are not compatible at the moment: "csr" and "interpolate_display" |
Merging this, support for CSR will come later. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I'll write some docs for the book, but it won't be published so here is a few things to know about the newly added "dynamic_load" feature:
Translations are separated in what I call "translations units", if you don't use namespaces, there is one for each locale, if you use namespaces, the units are the product of namespaces and locales.
The feature remove the translations from the client binary, they are still embedded in the server binary. The server will send the used translations units (only the ones being used) in the sent html, they are parsed when the page hydrate.
When an t unit is used but still isn't loaded, a request is sent to the server and the view will update once that request returns.
For obvious reason, requesting the translations is async, so when using "dynamic_load", most variants of the
t!
macro will return a future:t!
,td!
andtu!
will still return aimpl Fn() -> impl IntoView
, the future is handled inside of it, so you don't need to update anything with those.t*_string!
andt*_display!
return aimpl Future
, where the outputs areCow<'static, str>
andimpl Display
respectively, if you use those your code will need some updating.If you use a backend where server functions need to be register manually, there is the
ServerFn
associated type on theLocale
trait that the generatedLocale
enum implement thta you should register.