X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/dd9f7fea29e3f8bb61861f52984b7943512346ac..f78e4942ec0f3f6abd2992502e2d6c5c2e8e55f6:/wxPython/src/_intl.i diff --git a/wxPython/src/_intl.i b/wxPython/src/_intl.i index e1b7b7444e..5901e839a5 100644 --- a/wxPython/src/_intl.i +++ b/wxPython/src/_intl.i @@ -16,6 +16,7 @@ //--------------------------------------------------------------------------- %{ +#include %} //--------------------------------------------------------------------------- @@ -308,20 +309,54 @@ class wxLocale public: // ctor & dtor // ----------- - wxLocale(int language = wxLANGUAGE_DEFAULT, - int flags = wxLOCALE_LOAD_DEFAULT | wxLOCALE_CONV_ENCODING); + %extend { + wxLocale(int language = -1, + int flags = wxLOCALE_LOAD_DEFAULT | wxLOCALE_CONV_ENCODING) { + wxLocale* loc; + if (language == -1) + loc = new wxLocale(); + else + 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): @@ -433,8 +468,8 @@ wxLocale* wxGetLocale(); // get the translation of the string in the current locale %nokwargs wxGetTranslation; -wxString wxGetTranslation(const wxString& sz); -wxString wxGetTranslation(const wxString& sz1, const wxString& sz2, size_t n); +wxString wxGetTranslation(const wxString& str); +wxString wxGetTranslation(const wxString& str, const wxString& strPlural, size_t n); //--------------------------------------------------------------------------- %newgroup