QTranslator uses ui_languages to find translation

Loading translations was very static, now we use the array, the user
set in the gui to find a translation file.
This commit is contained in:
2023-01-06 13:56:33 +01:00
parent d0e6eefd0e
commit dee2da0d8c
2 changed files with 7 additions and 6 deletions

View File

@@ -487,10 +487,11 @@ def main() -> int:
try:
# Setup translation from file with system language
locale = QtCore.QLocale.system().name()
translator = QtCore.QTranslator()
locale_file_name = "revpicommander_{0}".format(locale)
translator.load(join(dirname(__file__), "locale", locale_file_name), suffix=".qm")
translator.load(
QtCore.QLocale.system(),
"revpicommander", "_", join(dirname(__file__), "locale"), ".qm"
)
app.installTranslator(translator)
except Exception:
pass