From b9ed96d4f82e76cfa4595dbad05ebd4fa6c02934 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Thu, 19 Apr 2018 09:04:29 -0400 Subject: [PATCH] [libcalamares] Special case sr@latin QLocale::name() doesn't include script information, and if it did it would probably use sr_RS@Latin; when searching for translation files it won't consider dropping just the country. --- src/libcalamares/utils/CalamaresUtils.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/libcalamares/utils/CalamaresUtils.cpp b/src/libcalamares/utils/CalamaresUtils.cpp index fe07c62a0..14228ece0 100644 --- a/src/libcalamares/utils/CalamaresUtils.cpp +++ b/src/libcalamares/utils/CalamaresUtils.cpp @@ -147,6 +147,12 @@ installTranslator( const QLocale& locale, if ( localeName == "C" ) localeName = "en"; + // Special case of sr@latin + if ( locale.language() == QLocale::Language::Serbian && locale.script() == QLocale::Script::LatinScript ) + localeName = QStringLiteral( "sr@latin" ); + + cDebug() << "Looking for translations for" << localeName; + QTranslator* translator = nullptr; // Branding translations @@ -167,11 +173,11 @@ installTranslator( const QLocale& locale, "_", brandingTranslationsDir.absolutePath() ) ) { - cDebug() << "Translation: Branding using locale:" << localeName; + cDebug() << " .. Branding using locale:" << localeName; } else { - cDebug() << "Translation: Branding using default, system locale not found:" << localeName; + cDebug() << " .. Branding using default, system locale not found:" << localeName; translator->load( brandingTranslationsPrefix + "en" ); } @@ -190,11 +196,11 @@ installTranslator( const QLocale& locale, translator = new QTranslator( parent ); if ( translator->load( QString( ":/lang/calamares_" ) + localeName ) ) { - cDebug() << "Translation: Calamares using locale:" << localeName; + cDebug() << " .. Calamares using locale:" << localeName; } else { - cDebug() << "Translation: Calamares using default, system locale not found:" << localeName; + cDebug() << " .. Calamares using default, system locale not found:" << localeName; translator->load( QString( ":/lang/calamares_en" ) ); }