{
public:
// ctor & dtor
+ // call Init() if you use this ctor
+ wxLocale();
// the ctor has a side effect of changing current locale
wxLocale(const char *szName, // name (for messages)
const char *szShort = NULL, // dir prefix (for msg files)
const char *szLocale = NULL, // locale (for setlocale)
- bool bLoadDefault = TRUE); // preload wxstd.mo?
+ bool bLoadDefault = TRUE) // preload wxstd.mo?
+ { Init(szName, szShort, szLocale, bLoadDefault); }
+ // the same as a function (returns TRUE on success)
+ bool Init(const char *szName,
+ const char *szShort = NULL,
+ const char *szLocale = NULL,
+ bool bLoadDefault = TRUE);
// restores old locale
~wxLocale();
// wxLocale
// ----------------------------------------------------------------------------
-// NB: ctor has (desired) side effect of changing current locale
-wxLocale::wxLocale(const char *szName,
- const char *szShort,
- const char *szLocale,
- bool bLoadDefault)
- : m_strLocale(szName), m_strShort(szShort)
+wxLocale::wxLocale()
{
+ m_pszOldLocale = NULL;
+ m_pMsgCat = NULL;
+}
+
+// NB: this function has (desired) side effect of changing current locale
+bool wxLocale::Init(const char *szName,
+ const char *szShort,
+ const char *szLocale,
+ bool bLoadDefault)
+{
+ m_strLocale = szName;
+ m_strShort = szShort;
+
// change current locale (default: same as long name)
if ( szLocale == NULL )
szLocale = szName;
// load the default catalog with wxWindows standard messages
m_pMsgCat = NULL;
+ bool bOk = TRUE;
if ( bLoadDefault )
- AddCatalog("wxstd");
+ bOk = AddCatalog("wxstd");
+
+ return bOk;
}
// clean up