It seems that most documentation on QTranslator
and installing them for a QApplication
assume simplistic cases for QLocale
.
In the real-world the locale of the user must take into account language and country, which is commonly achieved by having translation files first for a language (en
) and then additional translation files for each country using that language (en_US
).
Using the default QLocale()
, what is the most elegant way to load the appropriate translation files (one, two or none, depending on which exist)?
Here some code that get's it right, but is a bit too cumbersome.