if ( pszLcPath != NULL )
searchPath << GetAllMsgCatalogSubdirs(pszLcPath, lang);
+#ifdef __UNIX__
+ // add some standard ones and the one in the tree where wxWin was installed:
+ searchPath
+ << GetAllMsgCatalogSubdirs(wxString(wxGetInstallPrefix()) + wxT("/share/locale"), lang)
+ << GetAllMsgCatalogSubdirs(wxT("/usr/share/locale"), lang)
+ << GetAllMsgCatalogSubdirs(wxT("/usr/lib/locale"), lang)
+ << GetAllMsgCatalogSubdirs(wxT("/usr/local/share/locale"), lang);
+#endif // __UNIX__
+
// then take the current directory
// FIXME it should be the directory of the executable
#ifdef __WXMAC__
#else // !Mac
searchPath << GetAllMsgCatalogSubdirs(wxT("."), lang);
-#ifdef __UNIX__
- // and finally add some standard ones
- searchPath
- << GetAllMsgCatalogSubdirs(wxString(wxGetInstallPrefix()) + wxT("/share/locale"), lang)
- << GetAllMsgCatalogSubdirs(wxT("/usr/share/locale"), lang)
- << GetAllMsgCatalogSubdirs(wxT("/usr/lib/locale"), lang)
- << GetAllMsgCatalogSubdirs(wxT("/usr/local/share/locale"), lang);
-#endif // __UNIX__
-
#endif // platform
return searchPath;
bool wxLocale::Init(int language, int flags)
{
- wxLanguageInfo *info = NULL;
int lang = language;
-
- CreateLanguagesDB();
-
if (lang == wxLANGUAGE_DEFAULT)
{
// auto detect the language
return FALSE;
}
- if (lang != wxLANGUAGE_DEFAULT)
- {
- for (size_t i = 0; i < ms_languagesDB->GetCount(); i++)
- {
- if (ms_languagesDB->Item(i).Language == lang)
- {
- info = &ms_languagesDB->Item(i);
- break;
- }
- }
- }
+ const wxLanguageInfo *info = GetLanguageInfo(lang);
// Unknown language:
if (info == NULL)
return wxFONTENCODING_SYSTEM;
}
-/*static*/ void wxLocale::AddLanguage(const wxLanguageInfo& info)
+/* static */
+void wxLocale::AddLanguage(const wxLanguageInfo& info)
{
CreateLanguagesDB();
ms_languagesDB->Add(info);
}
+/* static */
+const wxLanguageInfo *wxLocale::GetLanguageInfo(int lang)
+{
+ CreateLanguagesDB();
+
+ size_t count = ms_languagesDB->GetCount();
+ for ( size_t i = 0; i < count; i++ )
+ {
+ if ( ms_languagesDB->Item(i).Language == lang )
+ {
+ return &ms_languagesDB->Item(i);
+ }
+ }
+
+ return NULL;
+}
+
wxString wxLocale::GetSysName() const
{
return wxSetlocale(LC_ALL, NULL);
wxLanguageInfo info;
wxStringTokenizer tkn;
- LNG(wxLANGUAGE_ABKHAZIAN, "ab" , 0 , 0 , "Abkhazian")
+ LNG(wxLANGUAGE_ABKHAZIAN, "ab" , 0 , 0 , "Abkhazian")
LNG(wxLANGUAGE_AFAR, "aa" , 0 , 0 , "Afar")
LNG(wxLANGUAGE_AFRIKAANS, "af_ZA", LANG_AFRIKAANS , SUBLANG_DEFAULT , "Afrikaans")
LNG(wxLANGUAGE_ALBANIAN, "sq_AL", LANG_ALBANIAN , SUBLANG_DEFAULT , "Albanian")