From 0e977a7e4295c0dfa7296219b15f0f7e08b5a0af Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sun, 25 Jul 2021 23:18:05 +0200 Subject: [PATCH] i18n: introduce special case for ca@valencia --- src/libcalamares/locale/Label.cpp | 4 ++++ src/libcalamares/locale/Label.h | 10 +++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/libcalamares/locale/Label.cpp b/src/libcalamares/locale/Label.cpp index 3dd5e09ee..740999e69 100644 --- a/src/libcalamares/locale/Label.cpp +++ b/src/libcalamares/locale/Label.cpp @@ -63,6 +63,10 @@ Label::getLocale( const QString& localeName ) QLocale loc( localeName ); // Ignores @latin return QLocale( loc.language(), QLocale::Script::LatinScript, loc.country() ); } + if ( localeName == QStringLiteral( "ca@valencia" ) ) + { + return QLocale( localeName ); // Ignores @valencia, but there is **really** no way to handle this + } return QLocale( localeName ); } diff --git a/src/libcalamares/locale/Label.h b/src/libcalamares/locale/Label.h index cf1d7701f..b0f17930a 100644 --- a/src/libcalamares/locale/Label.h +++ b/src/libcalamares/locale/Label.h @@ -27,6 +27,12 @@ namespace Locale * Support class to turn locale names (as used by Calamares's * translation system) into QLocales, and also into consistent * human-readable text labels. + * + * 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). + * - `ca@valencia` is the Catalan dialect spoken in Valencia. + * There is no Qt code for it. */ class Label : public QObject { @@ -86,9 +92,7 @@ public: /** @brief Get a Qt locale for the given @p localeName * - * 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). + * This obeys special cases as described in the class documentation. */ static QLocale getLocale( const QString& localeName );