pyload icon indicating copy to clipboard operation
pyload copied to clipboard

[Main] Demo for translating UI

Open OzzieIsaacs opened this issue 3 years ago • 1 comments

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

Additional references

OzzieIsaacs avatar Nov 01 '20 13:11 OzzieIsaacs

Hello @OzzieIsaacs! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers!We recommend to use black to automatically correct these files.

Comment last updated at 2021-05-04 18:11:13 UTC

pep8speaks avatar Nov 01 '20 13:11 pep8speaks