-
Notifications
You must be signed in to change notification settings - Fork 104
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
DX: Place i18n behind a feature flag. #422
Comments
Hmm, this would be tricky to do, and would not drop all the translation dependencies. I use Fluent for translations because it is much easier to work with than gettext ( I will not be moving away from Fluent, so that means there is a minimum required amount of machinery to take the single desired source language and hook it into the binary. It might be possible to remove a bunch of unnecessary translation code, but that would require changes to my upstream dependencies if they don't already have this functionality. One thing that might be more feasible, is to feature flag off support for more than one language. That would remove other languages from the binary, at least reducing the binary size that way. If someone wanted to investigate this, it would be interesting to see how it could be done in a maintainable way. |
Hey, thanks for the thoughtful response :) I like the idea of instead placing languages behind features flags. I should say though, (knowing nothing about i18n in rust), that feature flags should be additive. Cargo is very clear about this: https://doc.rust-lang.org/cargo/reference/features.html#feature-unification
I'm up for taking a look at this once it becomes relevant to the project I'm working on ✌️. |
Indeed, so the way it would be done (if even possible) is a default-enabled "all languages" flag, which depends on various per-language flags. Then someone can disable default features and re-enable whichever languages they want (though at least one must be present). |
I'm currently not interested in i18n support, and I'm writing an application where that binary size should be kept as small as possible.
Took a quick look at the crates.io metadata size and the dependency tree, and saw that the metrics were 1.42 MiB and 30% related to i18n respectively, both of which are a lot 🙈
Would such a change be viable?
The text was updated successfully, but these errors were encountered: