From 85fb220621d0b87a5570d114d753826a69eb8f41 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Thu, 23 Dec 2004 13:42:14 +0000 Subject: [PATCH] corrected setting the locale of the c-lib for mac git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31125 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/intl.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/common/intl.cpp b/src/common/intl.cpp index 70f1a49cec..2609e2c55a 100644 --- a/src/common/intl.cpp +++ b/src/common/intl.cpp @@ -1685,7 +1685,25 @@ bool wxLocale::Init(int language, int flags) wxLogError(wxT("Cannot set locale to language %s."), name.c_str()); return false; } -#elif defined(__WXMAC__) || defined(__WXPM__) +#elif defined(__WXMAC__) + if (language == wxLANGUAGE_DEFAULT) + locale = wxEmptyString; + else + locale = info->CanonicalName; + + wxMB2WXbuf retloc = wxSetlocale(LC_ALL, locale); + + if ( !retloc ) + { + // Some C libraries don't like xx_YY form and require xx only + retloc = wxSetlocale(LC_ALL, locale.Mid(0,2)); + } + if ( !retloc ) + { + wxLogError(wxT("Cannot set locale to '%s'."), locale.c_str()); + return false; + } +#elif defined(__WXPM__) wxMB2WXbuf retloc = wxSetlocale(LC_ALL , wxEmptyString); #else return false; -- 2.45.2