Request for an example of a multilingual application #4511
Closed
Nurgak
started this conversation in
Ideas / Feature Requests
Replies: 1 comment 7 replies
-
Short-term solution (slower language switch): Trigger browser reload by: https://nicegui.io/documentation/navigate#navigation_functions Long-term solution (faster language switch, but more complicated): Put everything inside a ui.refreshable: https://nicegui.io/documentation/refreshable |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I would like to better understand better how to make an application multilingual using NiceGUI. Understandably, it's already a solved problem and natively supported in Python via gettext.
I have successfully generated and edited all the necessary
.po
and.mo
language files. I can select the language from a drop-down in NiceGUI. The selected language setting is saved for the user using the NiceGUI storage function (via binding), so it will persist over reloads and navigation. However, the last bit is missing: when the desired language is selected the page language does not change, it requires a reload.For the life of me, I could not figure out how to reload a page using NiceGUI functions. I thought perhaps I was doing things wrong, maybe NiceGUI has the capability of reloading only the text, so a page refresh would not be necessary? Of course, I don't mind a full page refresh, this is even expected.
Now I don't know how to proceed. My application is correctly translated, the user can select the language, but the page behavior is incorrect: the page should immediately show the content in the selected language (auto reload), instead of requiring a press on the browser reload button.
It would be nice to have an example showing how to create a multilingual page using native Python tools and NiceGUI.
Beta Was this translation helpful? Give feedback.
All reactions