diff options
author | con <qtc-committer@nokia.com> | 2009-09-18 12:20:00 (GMT) |
---|---|---|
committer | con <qtc-committer@nokia.com> | 2009-09-18 12:22:54 (GMT) |
commit | 734f815a9325ad472517cd5ef869d6081eb89661 (patch) | |
tree | 57de9bf4746e8cd27c14d2fbcbf423395ac0a622 /src | |
parent | ad32d9a2d2c3b1202867f8563a69afb93effecd0 (diff) | |
download | Qt-734f815a9325ad472517cd5ef869d6081eb89661.zip Qt-734f815a9325ad472517cd5ef869d6081eb89661.tar.gz Qt-734f815a9325ad472517cd5ef869d6081eb89661.tar.bz2 |
System locale on Mac may not return AnyCountry for any language != C
Because of QLocale limitations this broke other places.
Reviewed-by: Denis Dzyubenko
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/tools/qlocale.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index a1f0712..136bafa 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -1216,9 +1216,12 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const QString preferredLanguage; QString preferredCountry; getMacPreferredLanguageAndCountry(&preferredLanguage, &preferredCountry); + QLocale::Language languageCode = (preferredLanguage.isEmpty() ? QLocale::C : codeToLanguage(preferredLanguage.data())); + QLocale::Country countryCode = (preferredCountry.isEmpty() ? QLocale::AnyCountry : codeToCountry(preferredCountry.data())); + const QLocalePrivate *d = findLocale(languageCode, countryCode); if (type == LanguageId) - return codeToLanguage(preferredLanguage.data()); - return codeToCountry(preferredCountry.data()); + return (QLocale::Language)d->languageId(); + return (QLocale::Country)d->countryId(); } case MeasurementSystem: |