extending locale detection
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50482 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -65,6 +65,7 @@ using namespace std ;
|
|||||||
#include "wx/mac/corefoundation/cfref.h"
|
#include "wx/mac/corefoundation/cfref.h"
|
||||||
#include <CoreFoundation/CFLocale.h>
|
#include <CoreFoundation/CFLocale.h>
|
||||||
#include "wx/mac/corefoundation/cfstring.h"
|
#include "wx/mac/corefoundation/cfstring.h"
|
||||||
|
#include <xlocale.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if wxUSE_WCHAR_T
|
#if wxUSE_WCHAR_T
|
||||||
@@ -162,6 +163,14 @@ char* wxSetlocale(int category, const char *locale)
|
|||||||
#ifdef __WXMAC__
|
#ifdef __WXMAC__
|
||||||
char *rv = NULL ;
|
char *rv = NULL ;
|
||||||
if ( locale != NULL && locale[0] == 0 )
|
if ( locale != NULL && locale[0] == 0 )
|
||||||
|
{
|
||||||
|
locale_t lt = newlocale(LC_ALL_MASK, "", NULL);
|
||||||
|
if ( lt )
|
||||||
|
{
|
||||||
|
rv = (char*) querylocale( LC_ALL_MASK, lt );
|
||||||
|
freelocale(lt);
|
||||||
|
}
|
||||||
|
if ( rv == NULL || rv[0] == 0 || strcmp( rv , "C" ) == 0 || strcmp( rv, "POSIX" ) == 0 )
|
||||||
{
|
{
|
||||||
// we have to emulate the behaviour under OS X
|
// we have to emulate the behaviour under OS X
|
||||||
wxCFRef<CFLocaleRef> userLocaleRef(CFLocaleCopyCurrent());
|
wxCFRef<CFLocaleRef> userLocaleRef(CFLocaleCopyCurrent());
|
||||||
@@ -171,6 +180,11 @@ char* wxSetlocale(int category, const char *locale)
|
|||||||
langFull += str.AsString();
|
langFull += str.AsString();
|
||||||
rv = setlocale(category, langFull.c_str());
|
rv = setlocale(category, langFull.c_str());
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rv = setlocale(category, rv);
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
rv = setlocale(category, locale);
|
rv = setlocale(category, locale);
|
||||||
#else
|
#else
|
||||||
|
Reference in New Issue
Block a user