Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #2 from martyone/master
Bugfix: LANG env variable is ignored
  • Loading branch information
rburchell committed May 27, 2013
2 parents 7f13bf7 + 8897b2d commit 62a51bc
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions src/mlocale.cpp
Expand Up @@ -1821,14 +1821,6 @@ MLocale::createSystemMLocale()
lcMonetary = pCurrentLcMonetary->value();
lcTelephone = pCurrentLcTelephone->value();

if ( !pCurrentLanguage->isValid() ) language = "en_GB";
if ( !pCurrentLcTime->isValid() ) lcTime = "en_GB";
if ( !pCurrentLcTimeFormat24h->isValid() ) lcTimeFormat24h = "12";
if ( !pCurrentLcCollate->isValid() ) lcCollate = "en_GB";
if ( !pCurrentLcNumeric->isValid() ) lcNumeric = "en_GB";
if ( !pCurrentLcMonetary->isValid() ) lcMonetary = "en_GB";
// no default for lcTelephone

delete pCurrentLanguage;
delete pCurrentLcTime;
delete pCurrentLcTimeFormat24h;
Expand All @@ -1841,14 +1833,21 @@ MLocale::createSystemMLocale()
MLocale *systemLocale;

if (language.isEmpty()) {
language = qgetenv("LANG");
QString locale = cleanLanguageCountryPosix(language);

if (locale.isEmpty())
locale = PosixStr;
QString locale = qgetenv("LANG");
language = cleanLanguageCountryPosix(locale);

if (language.isEmpty()) {
language = PosixStr;
lcTime = PosixStr;
lcTimeFormat24h = "12";
lcCollate = PosixStr;
lcNumeric = PosixStr;
lcMonetary = PosixStr;
// no default for lcTelephone
}

// No need to set the category according to env here
systemLocale = new MLocale(locale);
systemLocale = new MLocale(language);
} else {
// Empty country codes cause problems in some applications.
// Try to add the “right” country when reading the gconf
Expand Down

0 comments on commit 62a51bc

Please sign in to comment.