This PR aims to add support for multiple languages that can be changed at runtime.
The following languages are planned to be added:
[X] French
[X] German
[ ] Spanish
All the functionalities are brought by a new module lang.py which offers functions to get the current language, change the language, get the localized value of the desired GUI field.
When adding a new language, only the lang module needs to be modified as such:
The new language should be added in the Language enum.
An entry in the lang_map should be added where the first two letters of the corresponding locale should be mapped to the new enumeration entry like "en": Language.english. This allows for the language to be automatically detected on launch.
The translation for each field should be added in the ui_text variable.
An entry should be added in _available_languages where the key is the new enumeration entry and the value is the name of language in the language. For example, in French it would be: Language.french: "Français"
When adding a new text element in the GUI, the lang module should be modified as such:
The new field should be given a name in the GuiField enum.
An entry in ui_text should be added containing a translation for each available language.
If the text field is part of the main window, add an update entry in the _update_text_lang functions (gui.py).
Description
This PR aims to add support for multiple languages that can be changed at runtime.
The following languages are planned to be added:
All the functionalities are brought by a new module
lang.py
which offers functions to get the current language, change the language, get the localized value of the desired GUI field.When adding a new language, only the
lang
module needs to be modified as such:Language
enum.lang_map
should be added where the first two letters of the corresponding locale should be mapped to the new enumeration entry like"en": Language.english
. This allows for the language to be automatically detected on launch._available_languages
where the key is the new enumeration entry and the value is the name of language in the language. For example, in French it would be:Language.french: "Français"
When adding a new text element in the GUI, the
lang
module should be modified as such:GuiField
enum.ui_text
should be added containing a translation for each available language._update_text_lang
functions (gui.py
).