aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike FABIAN <mike.fabian@basyskom.de>2010-11-11 13:10:02 +0100
committerMike FABIAN <mike.fabian@basyskom.de>2010-11-11 13:39:55 +0100
commit3a415f0adf115f3dc0abc31dde14f7061c023ecd (patch)
tree87d7cf7d27f7c72930d9694b396638d0dd9d3324
parente1c6599fd33f41b0d14d2f7d4dc50291b7b03c2a (diff)
Changes: change regexp for parsing LANG to accept es_419 as well
RevBy: Björn Schnabel Details: es_419 isn’t really a valid value for LANG, but for consistency let’s make this behave the same way as the icu locale names work for es_419, we only use LANG as a fallback to specify a locale when gconf isn’t available or doesn’t work.
-rw-r--r--src/corelib/i18n/mlocale.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/corelib/i18n/mlocale.cpp b/src/corelib/i18n/mlocale.cpp
index c1365458..dbb8eb18 100644
--- a/src/corelib/i18n/mlocale.cpp
+++ b/src/corelib/i18n/mlocale.cpp
@@ -1174,8 +1174,15 @@ static QString
cleanLanguageCountryPosix(QString &localeString)
{
// we do not need the encoding and therefore use non-capturing
- // parentheses for the encoding part here:
- QRegExp regexp("([a-z]{2,3})(_([A-Z]{2,2}))?(?:.(?:[a-zA-Z0-9-]+))?(@([A-Z][a-z]+))?");
+ // parentheses for the encoding part here.
+ // The country part is usually a 2 letter uppercase code
+ // as in the above example, but there is the exception
+ // es_419, i.e. Spanish in Latin America where the “country code”
+ // is “419”. es_419 isn’t really a valid value for LANG, but for consistency
+ // let’s make this behave the same way as the icu locale names work for es_419,
+ // we only use LANG as a fallback to specify a locale when gconf isn’t available
+ // or doesn’t work.
+ QRegExp regexp("([a-z]{2,3})(_([A-Z]{2,2}|419))?(?:.(?:[a-zA-Z0-9-]+))?(@([A-Z][a-z]+))?");
if (regexp.indexIn(localeString) == 0 &&
regexp.capturedTexts().size() == 6) { // size of regexp pattern above