summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis Dzyubenko <denis.dzyubenko@nokia.com>2011-02-21 14:08:02 (GMT)
committerDenis Dzyubenko <denis.dzyubenko@nokia.com>2011-02-21 14:08:02 (GMT)
commitf08eb697ddc7bb473f3fe6b5545fca075d95481c (patch)
treeb4ef55bfcfc39d174ca262c9027205c7b1f99ac1
parent368a3259aa678e013078f8bb16a8de173d74759a (diff)
parent470376b6e0574c8a6740e24229ade859a29817f1 (diff)
downloadQt-f08eb697ddc7bb473f3fe6b5545fca075d95481c.zip
Qt-f08eb697ddc7bb473f3fe6b5545fca075d95481c.tar.gz
Qt-f08eb697ddc7bb473f3fe6b5545fca075d95481c.tar.bz2
Merge remote branch 'earth-team/4.7-i18n' into master-i18n
-rw-r--r--src/corelib/tools/qlocale.cpp6
-rw-r--r--tests/auto/qlocale/tst_qlocale.cpp3
2 files changed, 7 insertions, 2 deletions
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index fea96a7..985889c 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -274,7 +274,7 @@ static bool splitLocaleName(const QString &name, QChar *lang_begin, QChar *cntry
switch (state) {
case 0:
// parsing language
- if (uc->unicode() == '_') {
+ if (uc->unicode() == '_' || uc->unicode() == '-') {
state = 1;
break;
}
@@ -2360,7 +2360,7 @@ static quint16 localePrivateIndex(const QLocalePrivate *p)
/*!
Constructs a QLocale object with the specified \a name,
which has the format
- "language[_country][.codeset][@modifier]" or "C", where:
+ "language[_-country][.codeset][@modifier]" or "C", where:
\list
\i language is a lowercase, two-letter, ISO 639 language code,
@@ -2368,6 +2368,8 @@ static quint16 localePrivateIndex(const QLocalePrivate *p)
\i and codeset and modifier are ignored.
\endlist
+ The separator can be either underscore or a minus sign.
+
If the string violates the locale format, or language is not
a valid ISO 369 code, the "C" locale is used instead. If country
is not present, or is not a valid ISO 3166 code, the most
diff --git a/tests/auto/qlocale/tst_qlocale.cpp b/tests/auto/qlocale/tst_qlocale.cpp
index 441de6d..3217e5e 100644
--- a/tests/auto/qlocale/tst_qlocale.cpp
+++ b/tests/auto/qlocale/tst_qlocale.cpp
@@ -317,6 +317,8 @@ void tst_QLocale::ctor()
TEST_CTOR("en_GB.bla", English, UnitedKingdom)
TEST_CTOR("en_GB@.bla", English, UnitedKingdom)
TEST_CTOR("en_GB@bla", English, UnitedKingdom)
+ TEST_CTOR("en-GB", English, UnitedKingdom)
+ TEST_CTOR("en-GB@bla", English, UnitedKingdom)
Q_ASSERT(QLocale::Norwegian == QLocale::NorwegianBokmal);
TEST_CTOR("no", Norwegian, Norway)
@@ -327,6 +329,7 @@ void tst_QLocale::ctor()
TEST_CTOR("nn_NO", NorwegianNynorsk, Norway)
TEST_CTOR("es_ES", Spanish, Spain)
TEST_CTOR("es_419", Spanish, LatinAmericaAndTheCaribbean)
+ TEST_CTOR("es-419", Spanish, LatinAmericaAndTheCaribbean)
// test default countries for languages
TEST_CTOR("mn", Mongolian, Mongolia)