Ignore:
Timestamp:
Mar 3, 2010, 8:54:13 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

corelib: Implemented deriving the defaut locale from the process country code if LANG is not set and integration with the system locale object (System Setup -> Country Palette). Closes #123.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/corelib/tools/qstring.cpp

    r567 r622  
    46324632        return 0;
    46334633    }
    4634 #elif defined(Q_OS_OS2) && !defined(QT_NO_TEXTCODEC)
     4634#elif defined(Q_OS_OS2)
     4635    extern Q_CORE_EXPORT QString qt_system_locale_name(); // qlocale.cpp
     4636    // UniCreateLocaleObject("") creates an "en_US" locale when LANG is not set
     4637    // but we want to get the system locale so always use the exact name as
     4638    // returned by qt_system_locale_name() (it also takes LANG into account)
    46354639#if !defined(QT_NO_THREAD)
    46364640    static QAtomicPointer<void> localeObj;
    46374641    if (!localeObj) {
    46384642        LocaleObject lo = 0;
    4639         UniCreateLocaleObject(UNI_UCS_STRING_POINTER, (UniChar *)L"", &lo);
     4643        UniCreateLocaleObject(UNI_UCS_STRING_POINTER,
     4644                              qt_system_locale_name().utf16(), &lo);
    46404645        if (!localeObj.testAndSetRelaxed(0, lo))
    46414646            UniFreeLocaleObject(lo); // we are too late
     
    46444649    static LocaleObject localeObj = 0;
    46454650    if (!localeObj)
    4646         UniCreateLocaleObject(UNI_UCS_STRING_POINTER, (UniChar *)L"", &localeObj);
     4651        UniCreateLocaleObject(UNI_UCS_STRING_POINTER,
     4652                              qt_system_locale_name().utf16(), &localeObj);
    46474653#endif
    46484654    if (localeObj) {
Note: See TracChangeset for help on using the changeset viewer.