made wxLocale::GetSystemLanguage and wxLocale::AddLanguage static;

wxLocale now converts strings according to LC_CTYPE if it contains charset information (and uses old code otherwise)


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9578 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2001-03-25 22:19:44 +00:00
parent 323af1967c
commit 4178000933
3 changed files with 113 additions and 45 deletions

View File

@@ -55,6 +55,7 @@ class WXDLLEXPORT wxLanguageInfoArray;
// wxLanguage: defines all supported languages
// ----------------------------------------------------------------------------
// --- --- --- generated code begins here --- --- ---
// This enum is generated by misc/languages/genlang.py
// When making changes, please put them into misc/languages/langtabl.txt
@@ -62,7 +63,6 @@ enum wxLanguage
{
// user's default/preffered language as got from OS:
wxLANGUAGE_DEFAULT,
// unknown language, if wxLocale::GetSystemLanguage fails:
wxLANGUAGE_UNKNOWN,
@@ -299,6 +299,10 @@ enum wxLanguage
wxLANGUAGE_USER_DEFINED
};
// --- --- --- generated code ends here --- --- ---
// ----------------------------------------------------------------------------
// wxLanguageInfo: encapsulates wxLanguage to OS native lang.desc.
// translation information
@@ -341,7 +345,6 @@ public:
bool bLoadDefault = TRUE, // preload wxstd.mo?
bool bConvertEncoding = FALSE) // convert Win<->Unix if neccessary?
{
m_languagesDB = NULL;
Init(szName, szShort, szLocale, bLoadDefault, bConvertEncoding);
}
@@ -365,7 +368,7 @@ public:
// Try to get user's (or OS's) prefered language setting.
// Return wxLANGUAGE_UNKNOWN if language-guessing algorithm failed
int GetSystemLanguage() const;
static int GetSystemLanguage();
// return TRUE if the locale was set successfully
bool IsOk() const { return m_pszOldLocale != NULL; }
@@ -406,7 +409,7 @@ public:
// Add custom language to the list of known languages.
// Notes: 1) wxLanguageInfo contains platform-specific data
// 2) must be called before Init to have effect
void AddLanguage(const wxLanguageInfo& info);
static void AddLanguage(const wxLanguageInfo& info);
// retrieve the translation for a string in all loaded domains unless
// the szDomain parameter is specified (and then only this domain is
@@ -424,13 +427,19 @@ public:
// Returns the current short name for the locale
const wxString& GetName() const { return m_strShort; }
// These two methods are for internal use only. First one creates
// ms_languagesDB if it doesn't already exist, second one destroys
// it.
static void CreateLanguagesDB();
static void DestroyLanguagesDB();
private:
// find catalog by name in a linked list, return NULL if !found
wxMsgCatalog *FindCatalog(const wxChar *szDomain) const;
// copy default table of languages from global static array to
// m_langugagesInfo
void InitLanguagesDB();
// m_langugagesInfo, called by InitLanguagesDB
static void InitLanguagesDB();
wxString m_strLocale, // this locale name
m_strShort; // short name for the locale
@@ -443,7 +452,7 @@ private:
bool m_bConvertEncoding;
wxLanguageInfoArray *m_languagesDB;
static wxLanguageInfoArray *ms_languagesDB;
};
// ----------------------------------------------------------------------------