Replies: 1 comment 11 replies
-
|
To have a tree shaking working for the language - you need to bundle your app for each locale. If by tree-shaking, you and Paraglide author means code splitting, when different messages could go to a diffrent chunks of a bundle - yes, that actually possible, but not sure current bundlers could split the common files. Anyway - i like the idea, this is doable, however this would be a huge change in the architecture and shift in the paradigm of the lingui. Not sure how integrate this without a massive disruption for a users. |
Beta Was this translation helpful? Give feedback.
11 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
There is another great project that provides translations - Paraglide JS, and the killer feature of it is tree-shakable translations!
And, I believe, we can implement the same approach in Lingui too, as we have all the background for this already now!
So, instead of using a function like this:
we can generate a native JS function like this:
So the macro will transform a string from this:
to just this:
and this will be bundled into the target JS code inline, without needing to include the full array of translation messages at all!
Thinking forward, we can even prepare functions for concrete locales like this:
and call directly the function in the right locale, if the locale is static on the transpiling stage.
Beta Was this translation helpful? Give feedback.
All reactions