- Timestamp:
- Mar 5, 2010, 12:31:57 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/corelib/tools/qlocale.cpp
r623 r635 372 372 static uint default_number_options = 0; 373 373 374 #ifndef QT_NO_SYSTEMLOCALE375 374 static QByteArray envVarLocale() 376 375 { 377 static QByteArray lang = 0;378 #if def Q_OS_UNIX376 QByteArray lang; 377 #if defined(Q_OS_UNIX) || defined(Q_OS_OS2) 379 378 lang = qgetenv("LC_ALL"); 379 #if defined(Q_OS_UNIX) 380 380 if (lang.isNull()) 381 381 lang = qgetenv("LC_NUMERIC"); 382 #endif 382 383 if (lang.isNull()) 383 384 #endif … … 386 387 } 387 388 389 #if defined(Q_OS_OS2) 390 // Gets the system locale name. Also used by QString::localeAwareCompare() so 391 // must be available in QT_NO_SYSTEMLOCALE mode. 392 Q_CORE_EXPORT QString qt_system_locale_name() 393 { 394 QString locale = QString::fromLatin1(envVarLocale()); 395 if (locale.isEmpty()) { 396 // get the locale from the system country code 397 COUNTRYCODE code = { 0, 0 }; 398 COUNTRYINFO info; 399 ULONG actual; 400 APIRET arc = DosQueryCtryInfo(sizeof(info), &code, &info, &actual); 401 if (arc == NO_ERROR) { 402 UniChar localeName[8]; 403 if (UniMapCtryToLocale(info.country, localeName, 404 sizeof(localeName)) == ULS_SUCCESS) 405 locale = QString::fromUtf16(localeName); 406 } 407 } 408 409 return locale; 410 } 411 #endif 412 413 #ifndef QT_NO_SYSTEMLOCALE 388 414 389 415 #if defined(Q_OS_WIN) … … 944 970 ** Wrappers for OS/2 locale system functions 945 971 */ 946 947 Q_CORE_EXPORT QString qt_system_locale_name()948 {949 QString locale = QString::fromLatin1(envVarLocale());950 if (locale.isEmpty()) {951 // get the locale from the system country code952 COUNTRYCODE code = { 0, 0 };953 COUNTRYINFO info;954 ULONG actual;955 APIRET arc = DosQueryCtryInfo(sizeof(info), &code, &info, &actual);956 if (arc == NO_ERROR) {957 UniChar localeName[8];958 if (UniMapCtryToLocale(info.country, localeName,959 sizeof(localeName)) == ULS_SUCCESS)960 locale = QString::fromUtf16(localeName);961 }962 }963 964 return locale;965 }966 972 967 973 /*!
Note:
See TracChangeset
for help on using the changeset viewer.