-
-
Notifications
You must be signed in to change notification settings - Fork 642
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
Q: Have you considered locale specific bundles? #1418
Comments
i18next is mainly maintained by one person too (but has nowadays a fallback strategy) - but constantly over 10 years. The problem with creating such modules is you have to stay committed - which understandable can be hard at some time (we finally came over this by creating a company and a product supporting i18next -> locize.com) Generating a build output per language...sounds good. It's more or less the approach angular does with it's AOT compiler. It's absolutely doable...we do something similar with https://github.com/i18next/i18nextify -> auto instrument HTML pages. While it's a different source and result -> something similar should be possible during bundling using webpack. It's more a problem of knowing webpack and how to write a plugin doing the change for elements containing text and some HTML attributes on the elements. Another idea I would love to see implemented is extending react-dom reconciler to enable auto instrumentation of the text nodes -> translatable out of the box. So, possible? - for sure. Would I consider working on it - not really - I would support someone willing to do this...like I did eg. for next-i18next - but I'm not willing doing it fully on my own time... |
Fair enough. It's not some immediate pain for me either. I am at the beginning of building my own product and I am just thinking ahead where might be possible bottlenecks for performance (especially first time load). Can we keep the issue open for a while (there aren't many open) just in case someone finds it interesting and wants to dive in? |
sure...I tagged it for help wanted |
It's not using a bundler but can't this already be achieved with the fetch / axios backend? Or does it work differently? |
I think this is possible with vite and named exports dynamic imports. This should be chunkable/tree shakeable. Another option with vite would be to investigate how they are handling json and emulate the same. I documented my thoughts in issue for the new vite-plugin I just forked from our old webpack loader @alienfast/i18next-loader. |
Hello! |
I am sorry if I missed this somewhere, I am pretty much new to i18next. I am coming over from LinguiJS which is a neat framework but given its work of a single person, it's growing very slowly, basically stopped now.
There is the RFC for per-locale bundles which ultimately means bundles with minimal to none runtime footprint of localization library. Given that i18next is roughly over 15kB (min gzip, including React bindings), it would be a significant improvement in my opinion.
Probably best if you read through that RFC, I don't think I can add anything more here as I don't know exact internals of i18next. Would it be something you would consider working on? Do you think it would be even possible?
The text was updated successfully, but these errors were encountered: