-
Notifications
You must be signed in to change notification settings - Fork 85
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
enh: Split translations by components to only include needed strings in app bundles #4861
Conversation
ef12361
to
89ba852
Compare
89ba852
to
814f9c0
Compare
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
814f9c0
to
5fde15e
Compare
5fde15e
to
432e3a3
Compare
I fixed the issue with vite internal modules being present in output bundle, so it now also works if your app uses webpack ✔️ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The dist
looks good and correct without any extra translations, the translations on server and Talk work fine. Doesn't change a lot in size for 1 app, but multiplies for every app and library.
Thank you @susnux, awesome work! |
…in app bundles Translations are extracted, not translated strings are discarded (fallback to english) and compressed. On build time the translations are then injected by a vite plugin depending on the importing files so only used translations are imported. Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
…plitting Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
… longer needed Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
432e3a3
to
a966985
Compare
☑️ Resolves
On build time:
Then a vite plugin will intercept all imports for 'src/l10n.js' and replace the content with a wrapper that only injects the used translations of the importing file.
Results
Tested with logreader app:
Before
After
🏁 Checklist