1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-01 16:19:43 +02:00

Final (hopefully) fix for bug #947

This commit is contained in:
Leland Lucius 2015-06-04 03:29:27 -05:00
parent d76ed7e837
commit cbe77693ea

View File

@ -961,20 +961,27 @@ void AudacityApp::InitLang( const wxString & lang )
if( mLocale ) if( mLocale )
delete mLocale; delete mLocale;
// LL: I do not know why loading translations fail on the Mac if LANG is not wxString canon = lang;
// set, but for some reason it does. So wrap the creation of wxLocale
// with the default translation.
//
// 2013-09-13: I've checked this again and it is still required. Still
// no idea why.
// 2015-05-26: Disabled the hack since it prevents use of locale specific
// formatting (like comma as decimal separator).
#if defined(__WXMAC__disabled)
wxString oldval;
bool existed;
existed = wxGetEnv(wxT("LANG"), &oldval); #if defined(__MACOSX__)
wxSetEnv(wxT("LANG"), wxT("en_US")); // This should be reviewed again during the wx3 conversion.
// On OSX, the eventual call to setlocale() will fail to completely
// set the locale causing printf() and kin to still use the period
// as the decimal separator when the locale specifies something
// else.
const wxLanguageInfo *info = wxLocale::FindLanguageInfo(lang);
if (info) {
canon = info->CanonicalName;
}
// On OSX, if the LANG environment variable isn't set when
// using a language like Japanese, an assertion will trigger
// because conversion to Japanese from "?" doesn't return a
// valid length, so make OSX happy by defining/overriding
// the LANG environment variable with what the user has
// chosen.
wxSetEnv(wxT("LANG"), canon);
#endif #endif
#if wxCHECK_VERSION(3,0,0) #if wxCHECK_VERSION(3,0,0)
@ -983,15 +990,6 @@ void AudacityApp::InitLang( const wxString & lang )
mLocale = new wxLocale(wxT(""), lang, wxT(""), true, true); mLocale = new wxLocale(wxT(""), lang, wxT(""), true, true);
#endif #endif
#if defined(__WXMAC__disabled)
if (existed) {
wxSetEnv(wxT("LANG"), oldval);
}
else {
wxUnsetEnv(wxT("LANG"));
}
#endif
for(unsigned int i=0; i<audacityPathList.GetCount(); i++) for(unsigned int i=0; i<audacityPathList.GetCount(); i++)
mLocale->AddCatalogLookupPathPrefix(audacityPathList[i]); mLocale->AddCatalogLookupPathPrefix(audacityPathList[i]);