diff options
-rw-r--r-- | src/corelib/tools/qlocale.cpp | 51 |
1 files changed, 26 insertions, 25 deletions
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index 06beabbee3..c785a5882a 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -110,31 +110,32 @@ QLocale::Language QLocalePrivate::codeToLanguage(QStringView code) Q_DECL_NOTHRO return QLocale::Language((c - language_code_list)/3); } - // legacy codes - if (uc1 == 'n' && uc2 == 'o' && uc3 == 0) { // no -> nb - Q_STATIC_ASSERT(QLocale::Norwegian == QLocale::NorwegianBokmal); - return QLocale::Norwegian; - } - if (uc1 == 't' && uc2 == 'l' && uc3 == 0) { // tl -> fil - Q_STATIC_ASSERT(QLocale::Tagalog == QLocale::Filipino); - return QLocale::Tagalog; - } - if (uc1 == 's' && uc2 == 'h' && uc3 == 0) { // sh -> sr[_Latn] - Q_STATIC_ASSERT(QLocale::SerboCroatian == QLocale::Serbian); - return QLocale::SerboCroatian; - } - if (uc1 == 'm' && uc2 == 'o' && uc3 == 0) { // mo -> ro - Q_STATIC_ASSERT(QLocale::Moldavian == QLocale::Romanian); - return QLocale::Moldavian; - } - // Android uses the following deprecated codes - if (uc1 == 'i' && uc2 == 'w' && uc3 == 0) // iw -> he - return QLocale::Hebrew; - if (uc1 == 'i' && uc2 == 'n' && uc3 == 0) // in -> id - return QLocale::Indonesian; - if (uc1 == 'j' && uc2 == 'i' && uc3 == 0) // ji -> yi - return QLocale::Yiddish; - + if (uc3 == 0) { + // legacy codes + if (uc1 == 'n' && uc2 == 'o') { // no -> nb + Q_STATIC_ASSERT(QLocale::Norwegian == QLocale::NorwegianBokmal); + return QLocale::Norwegian; + } + if (uc1 == 't' && uc2 == 'l') { // tl -> fil + Q_STATIC_ASSERT(QLocale::Tagalog == QLocale::Filipino); + return QLocale::Tagalog; + } + if (uc1 == 's' && uc2 == 'h') { // sh -> sr[_Latn] + Q_STATIC_ASSERT(QLocale::SerboCroatian == QLocale::Serbian); + return QLocale::SerboCroatian; + } + if (uc1 == 'm' && uc2 == 'o') { // mo -> ro + Q_STATIC_ASSERT(QLocale::Moldavian == QLocale::Romanian); + return QLocale::Moldavian; + } + // Android uses the following deprecated codes + if (uc1 == 'i' && uc2 == 'w') // iw -> he + return QLocale::Hebrew; + if (uc1 == 'i' && uc2 == 'n') // in -> id + return QLocale::Indonesian; + if (uc1 == 'j' && uc2 == 'i') // ji -> yi + return QLocale::Yiddish; + } return QLocale::C; } |