Details
-
Suggestion
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
None
-
None
Description
QQmlApplicationEngine can automatically load Qt translation files (.qm files) on startup. Anyhow, it is rather restrictive in this:
- Translations need to be located in the resource system at :/qt/qml/<Module Name>/i18n
- The files need to start with qml_
The restriction on the file base name is especially limiting. As there's no convenient way to alias files in the current qt_add_translations API, it effectively forces users to also name their ts files the same. If really taken up by the user, a translator will get many .ts files named the same, for different apps.
Possible mitigations:
- Allow Module Name also as the name of the .qm file. So the path to check in addition would be e.g. :/qt/qml/<Module Name>/i18n/<Module Name>_de_DE.qm
- Just load all matching qm files inside the directory of the Qt resource system:
:/qt/qml/<Module Name>/i18n/*_de_DE.qm - Automatically rename .qm files as part of the qt_add_translations() call.