Change language at run-time #75

Closed
opened 2 years ago by duke · 6 comments
duke commented 2 years ago
Owner

Many users ask how to change the language of our wallets, not realizing it only uses the system/OS language. That is less intuitive and less flexible.

This guide seems to explain how to write the code for a QT app to change languages while running:

https://wiki.qt.io/How_to_create_a_multi_language_application

which uses https://doc.qt.io/qt-5/qtranslator.html

It even shows code to dynamically generate the list of supported languages from the *.qm files. I think we should avoid rendering a "flag" image next to the language name, because languages and country flags do not have a 1-to-1 relation.

Many users ask how to change the language of our wallets, not realizing it only uses the system/OS language. That is less intuitive and less flexible. This guide seems to explain how to write the code for a QT app to change languages while running: https://wiki.qt.io/How_to_create_a_multi_language_application which uses https://doc.qt.io/qt-5/qtranslator.html It even shows code to dynamically generate the list of supported languages from the `*.qm` files. I think we should avoid rendering a "flag" image next to the language name, because languages and country flags do not have a 1-to-1 relation.
Poster
Owner

This is currently being worked on in the language branch. It can currently dynamically render a list of all supported languages and it can change the language correctly to Russian at run-time. Still a few bugs to work out, but it's getting close.

This is currently being worked on in the `language` branch. It can currently dynamically render a list of all supported languages and it can change the language correctly to Russian at run-time. Still a few bugs to work out, but it's getting close.
Poster
Owner

This branch can now change to any language at run-time! 🎉 There are various small bugs that I will list here, to keep track of them:

  • Currently enabled language is not selected by default in combobox
  • Render language list in the native translation of that language, instead of listing all languages in English
  • The setting popup itself does not get translated, only the main window UI. Saving or exiting the settings popup, then going to it again, it will be translated.
  • Some languages (such as Chinese+Russian) seem to get theme names translated, which if chosen, become invalid theme names which will result in the default theme shown. This seems to happen intermittently, not all the time
  • When going to the settings after changing the language, the language is set back to English. This is related to keeping track of the current and default languages
  • The chosen language is not persisted across restarts of the wallet. We should probably store the current language a user chose in the config file
  • Filipino doesn't work correctly, because it's the only 3 letter language code (fil) and our code assumes they are 2 letter language codes
  • Unable to switch to back to English after switching to another language, lulz
  • List of languages is sorted by iso code, with English listed first because it's manually added. It should be sorted by language name with English sorted correctly
This branch can now change to any language at run-time! :tada: There are various small bugs that I will list here, to keep track of them: * [x] Currently enabled language is not selected by default in combobox * [x] Render language list in the native translation of that language, instead of listing all languages in English * [x] The setting popup itself does not get translated, only the main window UI. Saving or exiting the settings popup, then going to it again, it will be translated. * [ ] Some languages (such as Chinese+Russian) seem to get theme names translated, which if chosen, become invalid theme names which will result in the default theme shown. This seems to happen intermittently, not all the time * [x] When going to the settings after changing the language, the language is set back to English. This is related to keeping track of the current and default languages * [ ] The chosen language is not persisted across restarts of the wallet. We should probably store the current language a user chose in the config file * [x] Filipino doesn't work correctly, because it's the only 3 letter language code (fil) and our code assumes they are 2 letter language codes * [x] Unable to switch to back to English after switching to another language, lulz * [x] List of languages is sorted by iso code, with English listed first because it's manually added. It should be sorted by language name with English sorted correctly
Poster
Owner

Other notes for merging this branch:

  • There are new strings to translate
    • "Language changed to" in status bar
    • "Language" in Settings->Options (which is now the default settings tab)
    • "Theme changed to" in status bar
    • "Currency changed to" in status bar
Other notes for merging this branch: * There are new strings to translate * "Language changed to" in status bar * "Language" in Settings->Options (which is now the default settings tab) * "Theme changed to" in status bar * "Currency changed to" in status bar
Collaborator

Works good for me, it is might easier for translators now who maintain multiple languages, like me. 😇

Works good for me, it is might easier for translators now who maintain multiple languages, like me. 😇
Poster
Owner

This was merged to the dev branch a while ago

This was merged to the `dev` branch a while ago
Poster
Owner

this is done, closing

this is done, closing
duke closed this issue 2 years ago
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.