-
-
Notifications
You must be signed in to change notification settings - Fork 115
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
Provide i18n support #776
Comments
We should provide some better wrappers for the functions glib provides in For issues with gettext-rs I think it would be better to try to upstream another feature flag that does what we want. Everything else about that crate is fine, and it is still needed for some of the other gettext functions and enums anyway. |
What are those issues? Build-time / shipping issues like including a gettext tarball and building the C library are nothing you can cleanly handle via cargo features unfortunately. |
But it already does handle linking to the system library with a feature flag: https://github.com/Koka/gettext-rs/blob/ea91043635cfc44f442379d2b552166b7ec981a5/gettext-sys/build.rs#L88 We just need another flag that skips the compiling and uses a stub. |
BTW, this issue might be related to gettext-rs shipping its own copy: gtk-rs/gtk3-rs#755 |
cargo feature flags are supposed to be additive, so they don't really work for build configuration. It's something that has to be configured by whoever builds the final application, not by some crate somewhere in the dependency tree. Unfortunately cargo doesn't really have any mechanism for such configurations. |
The problem is the version uploaded to crates.io contains the tarball already, so it is not something you can avoid when cargo vendoring. |
Hmm, then that library should probably be forked. Unless we are ok with copying all functions into the glib crate |
Why not, it's not a lot of code. Or a separate We'd need that anyway so it makes use of our |
Also in relation to the Rust proxy-libintl implementation we talked about yesterday |
WIP branch with a It supports string formatting and has most of the functions from |
I guess after playing around with this a bit, I am skeptical compared to a native Rust implementation like |
If that works smoothly and consistent with other (C) applications then sure, why not. |
Let's move this to next milestone then. @jf2048 what's your plans/ideas/status here? |
Benchmark a pure rust implementation versus the glibc gettext and see what we need to do to improve it. It is possible we can end up more performant than C code by doing compile-time string hashing. I am not sure if it makes sense to try to reimplement the hashing algorithm from gettext or go with another one like |
Currently, gtk-rs based application that has to handle translations makes use of gettext-rs crate. It has some disadvantages like it shipping a gettext tarball when building under windows/macos(i think) which makes the vendored tarball of such applications pretty large for nothing when they target linux only.
Those gtk-rs applications also make use of various functions that are copy pasted between those applications, see https://gitlab.gnome.org/World/amberol/-/blob/main/src/i18n.rs for example. As glib itself provides helpers for making an application translatable, it would be nice to provide/expose some helper/wrapper functions.
cc @jf2048
The text was updated successfully, but these errors were encountered: