-
Notifications
You must be signed in to change notification settings - Fork 27
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
Use case question - Translating based on a "settings drop-down list" #41
Comments
Hi @psionikangel great news, I'm also interested to try out
By switching languages in the settings, do you mean in the system settings? I tried to implement support for detecting changes to system selected display language in the past, but closed the issue because it seemed difficult to implement on the desktop platform #30 I can't remember if I finished implementing support for it in the browser, but it was something that I had intended with the design but didn't seem super urgent because the user could just refresh the page to get the same effect. I should probably update the comment in that example to reflect the current state of support for this feature, as it's misleading, and I'm sorry if it caused some headaches! I'll do it soon when I update the library to the latest version of Fluent 🙂 In my applications, I've instead opted to make switching language at runtime an option in the application's settings. |
I hope I've addressed some of these issues in the new |
I was trying at runtime in the application's settings. So based on your comment, that should work? I guess then if you could point me at some example code to achieve that I would be very grateful, because as I said in my original post, switching the locale of the main thread did not trigger the listener as I was expecting it. |
@psionikangel yes it should work, but you'll have to do the change a different way, using the |
I'll take a stab at this @psionikangel – will use what you have done so far. |
@psionikangel do you think the question is answered here okay? Or is there some more that could be done? I'll certainly make a mental note that when some GUI examples are added for this project to include a change language dropdown list |
@kellpossible Yes, thank you for answering. You can close the issue. In the end, it was decided to postpone the translating feature because the UI framework mentionned above (iced) doesn't support all the charactersets that were needed for certain languages. |
Just tried to make an example of this using iced, and ran into the same problem, do you know if there is a tracking issue for it in iced? |
Yes, it is iced-rs/iced#103 |
Hi @kellpossible !
I have a use case question for you. I am working on adding localization on a rust app based on the very good
iced
UI framework. You can see the PR here if you are curious, but the extra context shouldn't be necessary to answer my question.Initially, I had used your library to translate the app based on the system locale (which worked wonderfully on both Mac OS and Windows). Then I tried to make the translation based on a "locale dropdown list" in the settings. (Meaning the fallback language would always be the default when the app loaded, but then the user could go in the settings, select an available language from the dropdown and the app would translate on the fly).
I have tried to achieve that using this example from your documentation
However, when trying it out I can't figure out why the translations aren't applied when I switch language in the settings. (After selecting the new language, the UI view refreshes and the UI elements are recreated, which in theory goes through the
tr!()
macro again and should produce UI elements with translated text).The method I tried was to switch the current thread locale with
But when using the debugger I can confirm that it doesn't seem to trigger anything.
The base question that I have I guess would be:
On what system event or other mechanism is the listener bound to in order to determine that the system requested language has changed?
And maybe a follow-up question would be :
Is the use-case that I'm trying to solve is at all supported by using your library? (I'm a complete newbie to Rust, so it would be very possible that I just didn't understand the library well enough before settling on using it).
Sorry for the very long rambling, I hope the question I have make sense.
Regards,
The text was updated successfully, but these errors were encountered: