kellpossible / cargo-i18n

A Rust Cargo sub-command and libraries to extract and build localization resources to embed in your application/library
MIT License
120 stars 24 forks source link

Localizations don't change after setting language override and calling poll() #94

Open m00nwtchr opened 1 year ago

m00nwtchr commented 1 year ago

I want to give users to option to use system locale or force a specific supported one in the app, and I'm using code adapted from the Localizer example, setting the language override before the first manual poll() works as expected, but when i do it afterwards in gui code, the language preference/order doesn't change (ie it's either still the system language or the language override i set at the start of the app). I'm using the fl! and println! macros to check the values.

https://github.com/m00nwtchr/cofd-pc-rs/blob/02aa5027ba2938f46699952871adb191205fb7d6/cofd/app/src/i18n.rs https://github.com/m00nwtchr/cofd-pc-rs/blob/02aa5027ba2938f46699952871adb191205fb7d6/cofd/app/src/main.rs#L219-L229

kellpossible commented 1 year ago

Hi thanks for reporting, I'll look into this today!

kellpossible commented 1 year ago

Which platform are you on by the way? The https://github.com/rust-locale/locale_config/ library used appears to be mostly abandoned and has existing issues, I haven't yet found a suitable replacement.

m00nwtchr commented 1 year ago

I'm on Arch Linux (btw, lol).

kellpossible commented 1 year ago

Hmm interesting, I'm also on Archlinux! Hopefully it will be easy for me to replicate