Translations were implemented recently in PowerTune, but the current approach based off a javascript array has several limitations:
as more strings, and especially more translations get added, this will become harder to maintain. Typically, translations are maintained using one file per languages (with tools like gettext, etc)
the current approach only allows translation of content within QML (and nothing from the c++ backend)
the javascript based translate function has to be called for every string that needs translating, everytime the content is refreshed. There is no caching mechanism.
The approach in this PR addresses the issues above, by leveraging native QT translation tools.
A c++ class is added to handle reloading the native translation component when switching to a new language.
Using a standard format also allows us to leverage crowd-sourced community based translation platforms like weblate where people can easily contribute new translations or new languages.
Translations were implemented recently in PowerTune, but the current approach based off a javascript array has several limitations:
The approach in this PR addresses the issues above, by leveraging native QT translation tools. A c++ class is added to handle reloading the native translation component when switching to a new language. Using a standard format also allows us to leverage crowd-sourced community based translation platforms like weblate where people can easily contribute new translations or new languages.
A test image for the rpi3 is available here and here for the rpi4.
The script used to pre-seed the .ts files from the Translator.js script is also provided.
The changes in action: