[Android]: Java uses some deprecated locale codes so account for these

There are three deprecated language codes that Java still uses for the
locale so we need to account for these inside QLocale by mapping them to
the right language.

Task-number: QTBUG-49632
Change-Id: Ib66b3f2763e085f7384228f2490b048bb56be259
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
bb10
Andy Shaw 2016-01-08 13:45:44 +01:00
parent e770728a33
commit 8c89a8b1ef
2 changed files with 9 additions and 1 deletions

View File

@ -116,6 +116,13 @@ QLocale::Language QLocalePrivate::codeToLanguage(const QString &code)
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;
return QLocale::C;
}

View File

@ -613,7 +613,8 @@ void tst_QLocale::legacyNames()
TEST_CTOR("no", Norwegian, Norway)
TEST_CTOR("sh_ME", Serbian, Montenegro)
TEST_CTOR("tl", Filipino, Philippines)
TEST_CTOR("iw", Hebrew, Israel)
TEST_CTOR("in", Indonesian, Indonesia)
#undef TEST_CTOR
}