Code: Select all
wxLocale * wbxDictApp::SetLocale(wxLanguage lang)
{
if (locale) delete locale ;
locale = new wxLocale() ;
// --- Enter block (~wxLogNull called at the end) ---
{
wxLogNull noLog ; // --- Prevent message "Cannot load locale"
locale->Init(lang) ;
}
// --- Load catalog ---
locale->AddCatalogLookupPathPrefix(wbxSTR_LOCALE_PATH) ;
bool loaded = locale->AddCatalog(wbxSTR_LOCALE_CAT) ;
if (!loaded)
{
wxString msg = wxString::Format(wbxMSG_NOLOCALE, locale->GetLocale()) ;
wbxWarningMessage(NULL, msg) ;
if (locale) delete locale ;
locale = new wxLocale() ;
// --- Load REAL English catalog ---
// --- Enter block (~wxLogNull called at the end) ---
{
wxLogNull noLog ; // --- Prevent message "Cannot load locale"
locale->Init(wxLANGUAGE_ENGLISH) ;
}
// --- Load catalog ---
locale->AddCatalogLookupPathPrefix(wbxSTR_LOCALE_PATH) ;
loaded = locale->AddCatalog(wbxSTR_LOCALE_CAT) ;
}
return locale ;
}