opral / inlang-paraglide-js

Tree-shakable i18n library build on the inlang ecosystem.
https://inlang.com/m/gerre34r/library-inlang-paraglideJs
52 stars 1 forks source link

Dynamic import of locales #222

Closed enjikaka closed 2 months ago

enjikaka commented 2 months ago

It's nice that Paraglide tree-shakes messages, but after implementing it in my project I noticed it has no way to tree-shake the actual locale files too. A user will use 1-2 locales (english on init and that or their chosen language going forward), so loading all of them is a big drawback; our app has something like 10 locales, so including them all has a big hit on our bundle size.

I think Paraglide should have dynamic imports of locales. Would be nice if we could find a good solution for that!

samuelstroschein commented 2 months ago

Yep, per language splitting is on the radar. Closing this as a duplicate of https://github.com/opral/inlang-paraglide-js/issues/88. In the meantime, with 10 locales your bundle size should still be lower than any runtime based i18n library, see https://inlang.com/m/gerre34r/library-inlang-paraglideJs/scaling