//---------------------------------------------------------------------------
%{
+#include <locale.h>
%}
//---------------------------------------------------------------------------
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):
// is used, the US default value is returned if everything else fails
// static wxString GetInfo(wxLocaleInfo index, wxLocaleCategory cat);
- // return TRUE if the locale was set successfully
+ // return True if the locale was set successfully
bool IsOk() const;
%pythoncode { def __nonzero__(self): return self.IsOk() };
//
// The loaded catalog will be used for message lookup by GetString().
//
- // Returns 'true' if it was successfully loaded
+ // Returns 'True' if it was successfully loaded
bool AddCatalog(const wxString& szDomain);
// check if the given catalog is loaded
// 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
// both modes gurantee that output string will have same length
// as input string
//
- // Returns FALSE if given conversion is impossible, TRUE otherwise
+ // Returns False if given conversion is impossible, True otherwise
// (conversion may be impossible either if you try to convert
// to Unicode with non-Unicode build of wxWindows or if input
// or output encoding is not supported.)
// equivalent encodings, regardless the platform, including itself.
static wxFontEncodingArray GetAllEquivalents(wxFontEncoding enc);
- // Return true if [any text in] one multibyte encoding can be
+ // Return True if [any text in] one multibyte encoding can be
// converted to another one losslessly.
//
// Do not call this with wxFONTENCODING_UNICODE, it doesn't make