diff options
author | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2011-02-02 12:41:47 (GMT) |
---|---|---|
committer | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2011-02-03 10:40:12 (GMT) |
commit | 470376b6e0574c8a6740e24229ade859a29817f1 (patch) | |
tree | 23faabc762c14281451595a80b1c64b3fe39555b /src | |
parent | 3d2504305fa39903ab680d7199cb4bb5427167e8 (diff) | |
download | Qt-470376b6e0574c8a6740e24229ade859a29817f1.zip Qt-470376b6e0574c8a6740e24229ade859a29817f1.tar.gz Qt-470376b6e0574c8a6740e24229ade859a29817f1.tar.bz2 |
Fixes QLocale locale name parsing.
Allow BCP47 dash as a language-country separator.
This only changes it one way - parsing 'en-US' will work, but
QLocale::name() will still return name with underscore as separator.
Task-number: QTBUG-15835
Reviewed-by: João Abecasis
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/tools/qlocale.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index 6b1de5e..5499fea 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; } @@ -2201,7 +2201,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, @@ -2209,6 +2209,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 |