From 740f1e7fe54923964cb20dfa710f85118c8a84e1 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sun, 25 Jul 2021 23:11:46 +0200 Subject: [PATCH] i18n: simplify Label handling of sr@latin --- src/libcalamares/locale/Label.cpp | 10 +++++----- src/libcalamares/locale/Label.h | 5 +++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/libcalamares/locale/Label.cpp b/src/libcalamares/locale/Label.cpp index b4ec8180c..3dd5e09ee 100644 --- a/src/libcalamares/locale/Label.cpp +++ b/src/libcalamares/locale/Label.cpp @@ -56,15 +56,15 @@ Label::getLocale( const QString& localeName ) { return QLocale(); } - if ( localeName.contains( "@latin" ) ) + + // Special cases + if ( localeName == QStringLiteral( "sr@latin" ) ) { QLocale loc( localeName ); // Ignores @latin return QLocale( loc.language(), QLocale::Script::LatinScript, loc.country() ); } - else - { - return QLocale( localeName ); - } + + return QLocale( localeName ); } } // namespace Locale diff --git a/src/libcalamares/locale/Label.h b/src/libcalamares/locale/Label.h index 58b2a3773..cf1d7701f 100644 --- a/src/libcalamares/locale/Label.h +++ b/src/libcalamares/locale/Label.h @@ -86,8 +86,9 @@ public: /** @brief Get a Qt locale for the given @p localeName * - * This special-cases `sr@latin`, which is used as a translation - * name in Calamares, while Qt recognizes `sr@latn`. + * This handles special-cases in Calamares translations: + * - `sr@latin` is the name which Qt recognizes as `sr@latn`, + * Serbian written with Latin characters (not Cyrillic). */ static QLocale getLocale( const QString& localeName );