From d9fdecd176ded44d1f8250301177a94303608463 Mon Sep 17 00:00:00 2001 From: "Jake.Stine" Date: Wed, 8 Dec 2010 03:56:08 +0000 Subject: [PATCH] i18n: Remove some redundant/legacy wxWidgets language codes, in particular regarding Traditional/Taiwan Chinese. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4079 96395faa-99c1-11dd-bbfe-3dabce05a288 --- pcsx2/gui/AppInit.cpp | 12 ++++++++---- pcsx2/gui/i18n.cpp | 18 ++++++++++++------ pcsx2/gui/i18n.h | 1 + 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/pcsx2/gui/AppInit.cpp b/pcsx2/gui/AppInit.cpp index 2f4d97e4b3..3aebe374f4 100644 --- a/pcsx2/gui/AppInit.cpp +++ b/pcsx2/gui/AppInit.cpp @@ -237,14 +237,18 @@ void Pcsx2App::OpenProgramLog() if( m_current_focus ) m_current_focus->SetFocus(); - /* // This is test code for printing out all supported languages and their canonical names in wiki-fied // format. I might use it again soon, so I'm leaving it in for now... --air + /* for( int li=wxLANGUAGE_UNKNOWN+1; liDescription.c_str(), info->CanonicalName.c_str() ); - }*/ + { + if (i18n_IsLegacyLanguageId((wxLanguage)info->Language)) continue; + Console.WriteLn( L"|| %-30s || %-8s ||", info->Description.c_str(), info->CanonicalName.c_str() ); + } + } + */ } void Pcsx2App::AllocateCoreStuffs() @@ -374,7 +378,7 @@ void Pcsx2App::OnInitCmdLine( wxCmdLineParser& parser ) const PluginInfo* pi = tbl_PluginInfo; do { parser.AddOption( wxEmptyString, pi->GetShortname().Lower(), - wxsFormat( _("specify the file to use as the %s plugin"), pi->GetShortname().c_str() ) + pxsFmt( _("specify the file to use as the %s plugin"), pi->GetShortname().c_str() ) ); } while( ++pi, pi->shortname != NULL ); diff --git a/pcsx2/gui/i18n.cpp b/pcsx2/gui/i18n.cpp index fce8d9b4da..c714e78772 100644 --- a/pcsx2/gui/i18n.cpp +++ b/pcsx2/gui/i18n.cpp @@ -45,15 +45,21 @@ LangPackEnumeration::LangPackEnumeration() englishName += L" [" + info->Description + L"]"; } +// Some of the codes provided by wxWidgets are 'obsolete' -- effectively replaced by more specific +// region-qualified language codes. This function can be used to filter them out. +bool i18n_IsLegacyLanguageId( wxLanguage lang ) +{ + return + (lang == wxLANGUAGE_ENGLISH) || + (lang == wxLANGUAGE_CHINESE) || + (lang == wxLANGUAGE_CHINESE_TAIWAN) || + (lang == wxLANGUAGE_SERBIAN) || + (lang == wxLANGUAGE_SPANISH); +} static void i18n_DoPackageCheck( wxLanguage wxLangId, LangPackList& langs ) { - // Plain english is a special case that's built in, and we only want it added to the list - // once, so we check for wxLANGUAGE_ENGLISH and then ignore other IsEnglish ids below. - if( wxLangId == wxLANGUAGE_ENGLISH ) - langs.push_back( LangPackEnumeration( wxLangId ) ); - - if( pxIsEnglish( wxLangId ) ) return; + if( i18n_IsLegacyLanguageId( wxLangId ) ) return; // Note: wx auto-preserves the current locale for us if( !wxLocale::IsAvailable( wxLangId ) ) return; diff --git a/pcsx2/gui/i18n.h b/pcsx2/gui/i18n.h index 1f293a288a..d8e9a21b85 100644 --- a/pcsx2/gui/i18n.h +++ b/pcsx2/gui/i18n.h @@ -38,4 +38,5 @@ typedef std::vector LangPackList; extern bool i18n_SetLanguage( const wxString& langCode ); extern bool i18n_SetLanguage( int wxLangId ); extern void i18n_EnumeratePackages( LangPackList& langs ); +extern bool i18n_IsLegacyLanguageId( wxLanguage lang );