diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2020-09-15 10:39:52 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-09-15 10:50:28 -0700 |
commit | 1ed8cb373f0b02299508087bf26fc23837625158 (patch) | |
tree | 079e87513a416b33fe223aa62cfafc3072c67e3b | |
parent | c1226a008a759b00b3ef2aeff7ab6817a37c4ca3 (diff) | |
download | subsurface-1ed8cb373f0b02299508087bf26fc23837625158.tar.gz |
translations: use the right Qt translations and try harder to find them
We were still using the 'qt' translations instead of 'qtbase' as we should have
been using since forever - it's a little unclear from reading the documentation
when in the Qt5 life cycle this happened, but definitely several years ago.
These are the strings used in situations where Qt already provides us with text
(e.g., the entries in the 'Subsurface' menu on Mac, or the button labels in
many dialogs).
Additionally we didn't try hard enough to find those translations in cases
where they are bundled with the app; so basically all scenarios except for
Linux distro specific packages or 'build from source' on macOS or Linux were
not going to work, even after addressing the qt->qtbase conversion.
But of course the developers pretty much all fall into those last two
categories. Still, I cannot believe we never fixed this in all those years...
To make it more obvious if we still aren't finding the Qt translations this
commit also makes that warning be shown in all cases, not just when running in
verbose mode.
Fixes #2954
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | core/qt-init.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/core/qt-init.cpp b/core/qt-init.cpp index 7f8af8379..587ace9a1 100644 --- a/core/qt-init.cpp +++ b/core/qt-init.cpp @@ -86,11 +86,13 @@ void init_qt_late() #else translationLocation = QLibraryInfo::location(QLibraryInfo::TranslationsPath); #endif - if (qtTranslator.load(loc, "qt", "_", translationLocation)) { + if (qtTranslator.load(loc, "qtbase", "_", translationLocation) || + qtTranslator.load(loc, "qtbase", "_", getSubsurfaceDataPath("translations")) || + qtTranslator.load(loc, "qtbase", "_", getSubsurfaceDataPath("../translations"))) { application->installTranslator(&qtTranslator); } else { - if (verbose && uiLang != "en_US" && uiLang != "en-US") - qDebug() << "can't find Qt localization for locale" << uiLang << "searching in" << translationLocation; + if (uiLang != "en_US" && uiLang != "en-US") + qDebug() << "can't find Qt base localization for locale" << uiLang << "searching in" << translationLocation; } if (ssrfTranslator.load(loc, "subsurface", "_") || ssrfTranslator.load(loc, "subsurface", "_", translationLocation) || |