]> git.saurik.com Git - wxWidgets.git/commitdiff
corrected setting the locale of the c-lib for mac
authorStefan Csomor <csomor@advancedconcepts.ch>
Thu, 23 Dec 2004 13:42:14 +0000 (13:42 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Thu, 23 Dec 2004 13:42:14 +0000 (13:42 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31125 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/intl.cpp

index 70f1a49cec52acdc453abcd63dc9ec4a8331cd23..2609e2c55ac8e637c7290db60bfe675f7c060784 100644 (file)
@@ -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;