summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@theqtcompany.com>2016-01-08 13:45:44 +0100
committerAndy Shaw <andy.shaw@theqtcompany.com>2016-01-13 12:37:56 +0000
commit8c89a8b1ef3e4ce549a5d0bbc4168c199e44f8cf (patch)
tree77caa5066583e0e535e4a402855eb5269bcf676e
parente770728a336d3218ad8b13c04bbea3324d241b48 (diff)
[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>
-rw-r--r--src/corelib/tools/qlocale.cpp7
-rw-r--r--tests/auto/corelib/tools/qlocale/tst_qlocale.cpp3
2 files changed, 9 insertions, 1 deletions
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index b1f53dc7a2..890a8fb95d 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -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;
}
diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
index 0466ced10a..5f046575c4 100644
--- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
+++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
@@ -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
}