summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis Dzyubenko <denis.dzyubenko@nokia.com>2011-03-29 13:16:29 (GMT)
committerDenis Dzyubenko <denis.dzyubenko@nokia.com>2011-03-29 15:18:08 (GMT)
commita60a0ac6629c06f9e6a8199000bc6cd49190afe0 (patch)
tree822fd0aa98a84966c6f9b2de150c56644f3be14b
parent65fba3f9e48a3fc89e10b15624d99493ad4a6bf7 (diff)
downloadQt-a60a0ac6629c06f9e6a8199000bc6cd49190afe0.zip
Qt-a60a0ac6629c06f9e6a8199000bc6cd49190afe0.tar.gz
Qt-a60a0ac6629c06f9e6a8199000bc6cd49190afe0.tar.bz2
Use region name as a locale name on Mac.
This changes the behavior as before we were returning the name that we read from System Preferences -> Language which represents the language for UI translation. Now that we have QLocale::uiLanguages() we don't need a hack that returned UI language as a locale name. This essentially reverts adb6eea3a135707a220c0b1c1cf8266321af9309. Reviewed-by: con
-rw-r--r--src/corelib/tools/qlocale_mac.mm31
1 files changed, 0 insertions, 31 deletions
diff --git a/src/corelib/tools/qlocale_mac.mm b/src/corelib/tools/qlocale_mac.mm
index 172997d..29d9a53 100644
--- a/src/corelib/tools/qlocale_mac.mm
+++ b/src/corelib/tools/qlocale_mac.mm
@@ -368,23 +368,6 @@ static QVariant macQuoteString(QSystemLocale::QueryType type, const QStringRef &
}
#endif //QT_NO_SYSTEMLOCALE
-static void getMacPreferredLanguageAndCountry(QString *language, QString *country)
-{
- QCFType<CFArrayRef> languages = (CFArrayRef)CFPreferencesCopyValue(
- CFSTR("AppleLanguages"),
- kCFPreferencesAnyApplication,
- kCFPreferencesCurrentUser,
- kCFPreferencesAnyHost);
- if (languages && CFArrayGetCount(languages) > 0) {
- QCFType<CFLocaleRef> locale = CFLocaleCreate(kCFAllocatorDefault,
- CFStringRef(CFArrayGetValueAtIndex(languages, 0)));
- if (language)
- *language = QCFString::toQString(CFStringRef(CFLocaleGetValue(locale, kCFLocaleLanguageCode)));
- if (country)
- *country = QCFString::toQString(CFStringRef(CFLocaleGetValue(locale, kCFLocaleCountryCode)));
- }
-}
-
#ifndef QT_NO_SYSTEMLOCALE
QLocale QSystemLocale::fallbackLocale() const
@@ -432,20 +415,6 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const
case PositiveSign:
case ZeroDigit:
break;
- case LanguageId:
- case CountryId: {
- QString preferredLanguage;
- QString preferredCountry;
- getMacPreferredLanguageAndCountry(&preferredLanguage, &preferredCountry);
- QLocale::Language languageCode = (preferredLanguage.isEmpty() ? QLocale::C : QLocalePrivate::codeToLanguage(preferredLanguage));
- QLocale::Country countryCode = (preferredCountry.isEmpty() ? QLocale::AnyCountry : QLocalePrivate::codeToCountry(preferredCountry));
- const QLocalePrivate *d = QLocalePrivate::findLocale(languageCode, QLocale::AnyScript, countryCode);
- if (type == LanguageId)
- return (QLocale::Language)d->languageId();
- return (QLocale::Country)d->countryId();
- }
- case ScriptId:
- return QVariant(QLocale::AnyScript);
case MeasurementSystem:
return QVariant(static_cast<int>(macMeasurementSystem()));