From 1ed8cb373f0b02299508087bf26fc23837625158 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Tue, 15 Sep 2020 10:39:52 -0700 Subject: 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 --- core/qt-init.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'core') 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) || -- cgit v1.2.3-70-g09d2