Closed 1sra3l closed 3 years ago
It should be possible. FLUID just wraps the text ina gettext macro, which can be replaced with a Rust based macro from one of the i18n crates, which I also haven’t worked with so I don’t have any preferences. I’ll take a look thru some of them.
Oh good idea! Thank you for looking, I have not used any of the i18n crates, so I am sure whatever you find will work. Thank you for looking into this. It is so exciting to quickly build UI for Rust apps, having translations will make it even better!
I've published version 0.4.4. If you enable internalization in FLUID, it should prepend all labels with the tr! macro from the tr crate. tr uses gettext-rs (C Wrapper) or gettext (rust reimplementation) and only requires initialization in the main.rs file:
#[macro_use]
extern crate tr;
fn main() {
tr_init!("some path");
// rest of the code
}
gettext-rs has build issues with window msvc, so to use the rust reimplementation, you would need to disable gettext-rs since it's the default for tr:
[dependencies]
tr = { version = "*", default-features=false, features=["gettext"] }
tr has its own ecosystem built on it with tools to extract strings and others to embed translation files with cargo etc.
I suppose I should have closed this already, sorry for the delay
As you probably know you can use localization for the
label
of widgets in C++. The output looks great, everything retains their "C++"Name:
field! This is just fantastic work! I don't know the best localization methods in rust yet, nor much about how to do it. I know the label would need to be some sort of mutable string, that can be set from a LANG.po file if that${LANG/_*}
.po file exists. But I have only used C++ and shell for this type of thing. This is what the fld file has:OR
It may be better to do it from the rust fluid, perhaps?