]> git.saurik.com Git - wxWidgets.git/commitdiff
use correct locale in GetInfo() under Mac (slightly modified patch 1884290)
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 10 Feb 2008 00:11:56 +0000 (00:11 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 10 Feb 2008 00:11:56 +0000 (00:11 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51625 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/intl.cpp

index 8b94852d843ea908844c33becb52acdc8b9f4517..402c20f26ab4682acd9a76dfd0f3eb595448bfb6 100644 (file)
@@ -2650,7 +2650,22 @@ wxString wxLocale::GetInfo(wxLocaleInfo index, wxLocaleCategory WXUNUSED(cat))
 /* static */
 wxString wxLocale::GetInfo(wxLocaleInfo index, wxLocaleCategory WXUNUSED(cat))
 {
-    wxCFRef<CFLocaleRef> userLocaleRef(CFLocaleCopyCurrent());
+    CFLocaleRef userLocaleRefRaw;
+    if ( wxGetLocale() )
+    {
+        userLocaleRefRaw = CFLocaleCreate
+                           (
+                                kCFAllocatorDefault,
+                                wxCFStringRef(wxGetLocale()->GetCanonicalName())
+                           );
+    }
+    else // no current locale, use the default one
+    {
+        userLocaleRefRaw = CFLocaleCopyCurrent();
+    }
+
+    wxCFRef<CFLocaleRef> userLocaleRef(userLocaleRefRaw);
+
     CFTypeRef cfstr;
     switch ( index )
     {