]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/_intl.i
Added autoconf makefiles for FoldBar extended samples
[wxWidgets.git] / wxPython / src / _intl.i
index 22f868cf08712004336505d148e5b24125245435..5901e839a58e76377490f092deb2f89b341e6b36 100644 (file)
@@ -16,6 +16,7 @@
 //---------------------------------------------------------------------------
 
 %{
+#include <locale.h>
 %}
 
 //---------------------------------------------------------------------------
@@ -311,24 +312,51 @@ public:
     %extend {
         wxLocale(int language = -1,
                  int flags = wxLOCALE_LOAD_DEFAULT | wxLOCALE_CONV_ENCODING) {
+            wxLocale* loc;
             if (language == -1)
-                return new wxLocale();
+                loc = new wxLocale();
             else
-                return new wxLocale(language, flags);
+                loc = new wxLocale(language, flags);
+            // Python before 2.4 needs to have LC_NUMERIC set to "C" in order
+            // for the floating point conversions and such to work right.
+%#if PY_VERSION_HEX < 0x02040000
+            setlocale(LC_NUMERIC, "C");
+%#endif
+            return loc;
         }
     }
 
         // restores old locale
     ~wxLocale();
 
-    %name(Init1)bool Init(const wxString& szName,
-                          const wxString& szShort = wxPyEmptyString,
-                          const wxString& szLocale = wxPyEmptyString,
-                          bool bLoadDefault = True,
-                          bool bConvertEncoding = False);
+    %extend { 
+        bool Init1(const wxString& szName,
+                   const wxString& szShort = wxPyEmptyString,
+                   const wxString& szLocale = wxPyEmptyString,
+                   bool bLoadDefault = true,
+                   bool bConvertEncoding = false) {
+            bool rc = self->Init(szName, szShort, szLocale, bLoadDefault, bConvertEncoding);
+            // Python before 2.4 needs to have LC_NUMERIC set to "C" in order
+            // for the floating point conversions and such to work right.
+%#if PY_VERSION_HEX < 0x02040000
+            setlocale(LC_NUMERIC, "C");
+%#endif
+            return rc;
+        }
+
+        bool Init2(int language = wxLANGUAGE_DEFAULT,
+                   int flags = wxLOCALE_LOAD_DEFAULT | wxLOCALE_CONV_ENCODING) {
+            bool rc = self->Init(language, flags);
+            // Python before 2.4 needs to have LC_NUMERIC set to "C" in order
+            // for the floating point conversions and such to work right.
+%#if PY_VERSION_HEX < 0x02040000
+            setlocale(LC_NUMERIC, "C");
+%#endif
+            return rc;
+        }
+    }
 
-    %name(Init2) bool Init(int language = wxLANGUAGE_DEFAULT,
-                           int flags = wxLOCALE_LOAD_DEFAULT | wxLOCALE_CONV_ENCODING);
+    
 
     %pythoncode {
     def Init(self, *_args, **_kwargs):