Skip to content

Improve fallback handling for Qt translation catalog loading

Volker Krause requested to merge work/vkrause/multi-lang-qt-catalog-loading into master

This removes our own very basic logic for this and instead passes the full locale to Qt. Unlike the previous code here Qt not only falls back to the generic language variant but also considers additional fallback languages (via QLocale::uiLanguages).

This means that e.g. for af_ZA:de_DE we now get German rather than English texts (af being a language Qt has no translations for).

There are still limitations though:

  • For Windows and macOS the code here manually reads LANGUAGE and creates a new locale for only the first language, so a multi-language configuration (assuming that's a thing on those platforms at all) still wont work.
  • Qt only loads the first matching catalog. This works as long as all catalogs are complete, ie. we wont get partial fallback with this like we have with the gettext based translations.

If we want/need to address those issues as well, we'd probably need to do the catalog finding/matching here ourselves.

Merge request reports

Loading