pyload
pyload copied to clipboard
[Main] Demo for translating UI
Describe the changes
Currently the translation files for the backend are missing and the translation for the WebUI isn't working. This PR creates a demo for translating the UI, to have a base for discussing further development. It also addresses issue: #3725
First the easy one: Issue #3725: The traceback is thrown because there are no locale files for "en", but this will also never happen, so I added a if lang == "en":
do not output traceback expression.
Next one: The webserver is initialized in __init__() function, so self._ is not a valid function, therefore the "starting webserver" message is never outputted translated, as it's the only string in webserver thread to translate, I removed the corresponding function.
I added demo files for the german translation (only a few strings are translated, as demo). The mechanism for doing the WebUI translation is setting the default locale to the choosen language, so a language change requires a restart of pyload-ng.
The code conflicts a bit with the path_prefix change, I hope you can manage this for getting a basic impression.
Now my questions:
The implementation now uses 2 language files for backend (pyload.mo) and frontend (message.mo), shall we change it to one file, or leave it seperate?
How do you plan to generate the language files (looks like apart from documentation it should be babel), then it would be better to have one language file (.mo) where both (back- and frontend) take their translations from?
Do you want to use crowdin for doing the translation work?
Is it okay to have the language change valid after reboot (changing this would create bigger impact, as I can oversee it now)?
Adding translated languages to pyload-ng currently requires a manual edit of pyload.cfg file, shall this be also the future way?
Is this related to a problem?
Translation of UI is currently not working