Last active
August 29, 2015 14:01
-
-
Save brunoeagle/6fab968b8029976faea8 to your computer and use it in GitHub Desktop.
wxHexEditor language setter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void wxHexEditorApp::SetLanguage(void){ | |
//wxString lang = wxConfigBase::Get()->Read( _T("Language"), wxEmptyString );^M | |
int sysLanguage = wxLocale::GetSystemLanguage(); | |
/*if ( lang.IsEmpty() or | |
wxLocale::FindLanguageInfo( lang ) == NULL ){ | |
lang=wxT("English"); //Defaulting to english. | |
wxConfigBase::Get()->Write( _T("Language"), _T("English") ); | |
wxConfigBase::Get()->Flush(); | |
}^M*/ | |
//int langid = wxLocale::FindLanguageInfo( lang )->Language; | |
//if ( !myLocale.Init( langid ) ){ | |
if ( !myLocale.Init( sysLanguage ) ) { // try to set the default system language | |
if ( !myLocale.Init( wxLANGUAGE_ENGLISH ) ) { // if fail, try english | |
return; | |
} | |
} | |
wxFileName flnm(argv[0]); //take current path and search "locale" directory^M | |
myLocale.AddCatalogLookupPathPrefix( flnm.GetPath(wxPATH_GET_SEPARATOR) + _T("locale") ); | |
//#ifdef _UNIX_^M | |
// myLocale.AddCatalogLookupPathPrefix( _T("/usr/local/share/locale/") );^M | |
//#endif^M | |
#ifdef __WXMAC__ | |
myLocale.AddCatalogLookupPathPrefix( flnm.GetPath(wxPATH_GET_SEPARATOR) + _T("..") + wxFileName::GetPathSeparator() + _T("Resources") + wxFileName::GetPathSeparator() + _T("locale") ); | |
#endif | |
myLocale.AddCatalog(_T("wxHexEditor")); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment