// Multiple language ID are actually mostly identical languages. In case a translation is not // yet provided for the dialect fallback to the main one. It would reduce the burden of the // translators and reduce the language pack. static wxLanguage i18n_FallbackToAnotherLang( wxLanguage wxLangId ) { // if some translations are provided, do not change the language LangPackList dummy_lang; bool valid_stat = false; i18n_DoPackageCheck(wxLangId, dummy_lang, valid_stat); if (valid_stat) return wxLangId; switch(wxLangId) { case wxLANGUAGE_CHINESE_HONGKONG : case wxLANGUAGE_CHINESE_MACAU : return wxLANGUAGE_CHINESE_TRADITIONAL; case wxLANGUAGE_CHINESE_SINGAPORE : return wxLANGUAGE_CHINESE_SIMPLIFIED; case wxLANGUAGE_SAMI : case wxLANGUAGE_SWEDISH_FINLAND : return wxLANGUAGE_SWEDISH; case wxLANGUAGE_PORTUGUESE : return wxLANGUAGE_PORTUGUESE_BRAZILIAN; // Overkill 9000? case wxLANGUAGE_GERMAN_AUSTRIAN : case wxLANGUAGE_GERMAN_BELGIUM : case wxLANGUAGE_GERMAN_LIECHTENSTEIN : case wxLANGUAGE_GERMAN_LUXEMBOURG : case wxLANGUAGE_GERMAN_SWISS : return wxLANGUAGE_GERMAN; case wxLANGUAGE_ITALIAN_SWISS : return wxLANGUAGE_ITALIAN; default : break; } return wxLangId; }
// Finds all valid PCSX2 language packs, and enumerates them for configuration selection. // Note: On linux there's no easy way to reliably enumerate language packs, since every distro // could use its own location for installing pcsx2.mo files (wtcrap?). Furthermore wxWidgets // doesn't give us a public API for checking what the language search paths are. So the only // safe way to enumerate the languages is by forcibly loading every possible locale in the wx // database. Anything which hasn't been installed will fail to load. // // Because loading and hashing the entire pcsx2 translation for every possible language would be // asinine and slow, I've decided to use a file dedicated to being a translation detection anchor. // This file is named pcsx2ident.mo, and contains only the name of the language in the language // native form. Additional translation files are only loaded if the user picks the language (or // if it's the default language of the user's OS installation). // void i18n_EnumeratePackages( LangPackList& langs ) { wxDoNotLogInThisScope here; // wx generates verbose errors if languages don't exist, so disable them here. langs.push_back( LangPackEnumeration() ); bool valid_stat_dummy; for( int li=wxLANGUAGE_UNKNOWN+1; li<wxLANGUAGE_USER_DEFINED; ++li ) { i18n_DoPackageCheck( (wxLanguage)li, langs, valid_stat_dummy ); } // Brilliant. Because someone in the wx world didn't think to move wxLANGUAGE_USER_DEFINED // to a place where it wasn't butt right up against the main languages (like, say, start user // defined values at 4000 or something?), they had to add new languages in at some arbitrary // value instead. Let's handle them here: // fixme: these won't show up in alphabetical order if they're actually present (however // horribly unlikely that is)... do we care? Probably not. // Note: These aren't even available in some packaged Linux distros anyway. >_< //i18n_DoPackageCheck( wxLANGUAGE_VALENCIAN, englishNames, xlatedNames ); //i18n_DoPackageCheck( wxLANGUAGE_SAMI, englishNames, xlatedNames ); }
// Multiple language ID are actually mostly identical languages. In case a translation is not // yet provided for the dialect fallback to the main one. It would reduce the burden of the // translators and reduce the language pack. static wxLanguage i18n_FallbackToAnotherLang( wxLanguage wxLangId ) { // if some translations are provided, do not change the language LangPackList dummy_lang; bool valid_stat = false; i18n_DoPackageCheck(wxLangId, dummy_lang, valid_stat); if (valid_stat) return wxLangId; switch(wxLangId) { case wxLANGUAGE_ARABIC_ALGERIA : case wxLANGUAGE_ARABIC_BAHRAIN : case wxLANGUAGE_ARABIC_EGYPT : case wxLANGUAGE_ARABIC_IRAQ : case wxLANGUAGE_ARABIC_JORDAN : case wxLANGUAGE_ARABIC_KUWAIT : case wxLANGUAGE_ARABIC_LEBANON : case wxLANGUAGE_ARABIC_LIBYA : case wxLANGUAGE_ARABIC_MOROCCO : case wxLANGUAGE_ARABIC_OMAN : case wxLANGUAGE_ARABIC_QATAR : case wxLANGUAGE_ARABIC_SAUDI_ARABIA : case wxLANGUAGE_ARABIC_SUDAN : case wxLANGUAGE_ARABIC_SYRIA : case wxLANGUAGE_ARABIC_TUNISIA : case wxLANGUAGE_ARABIC_UAE : case wxLANGUAGE_ARABIC_YEMEN : return wxLANGUAGE_ARABIC; case wxLANGUAGE_CHINESE_HONGKONG : case wxLANGUAGE_CHINESE_MACAU : return wxLANGUAGE_CHINESE_TRADITIONAL; case wxLANGUAGE_CHINESE_SINGAPORE : return wxLANGUAGE_CHINESE_SIMPLIFIED; // case wxLANGUAGE_SAMI_INARI_FINLAND : // case wxLANGUAGE_SAMI_NORTHERN_FINLAND : // case wxLANGUAGE_SAMI_SKOLT_FINLAND : return wxLANGUAGE_FINNISH; // - not supported by wxWidgets (2.9.4). case wxLANGUAGE_SAMI : // Most of the samis live in Norway. // case wxLANGUAGE_SAMI_LULE_NORWAY : // case wxLANGUAGE_SAMI_NORTHERN_NORWAY : // case wxLANGUAGE_SAMI_SOUTHERN_NORWAY : // - not supported by wxWidgets (2.9.4). case wxLANGUAGE_DANISH : case wxLANGUAGE_NORWEGIAN_NYNORSK : return wxLANGUAGE_NORWEGIAN_BOKMAL; // case: wxLANGUAGE_SAMI_LULE_SWEDEN : // case: wxLANGUAGE_SAMI_NORTHERN_SWEDEN : // case: wxLANGUAGE_SAMI_SOUTHERN_SWEDEN : // - not supported by wxWidgets (2.9.4). case wxLANGUAGE_SWEDISH_FINLAND : return wxLANGUAGE_SWEDISH; // case wxLANGUAGE_LUXEMBOURGISH : // - not supported by wxWidgets (2.9.4). case wxLANGUAGE_AFRIKAANS : // case wxLANG_FRISIAN : // - not supported by wxWidgets (2.9.4). case wxLANGUAGE_DUTCH_BELGIAN : return wxLANGUAGE_DUTCH; case wxLANGUAGE_PORTUGUESE : return wxLANGUAGE_PORTUGUESE_BRAZILIAN; // Overkill 9000? case wxLANGUAGE_GERMAN_AUSTRIAN : case wxLANGUAGE_GERMAN_BELGIUM : case wxLANGUAGE_GERMAN_LIECHTENSTEIN : case wxLANGUAGE_GERMAN_LUXEMBOURG : // Currently wxWidgets (2.9.4) doesn't support Sorbian. // case wxLANGUAGE_LOWER_SORBIAN : // case wxLANGUAGE_UPPER_SORBIAN : case wxLANGUAGE_GERMAN_SWISS : return wxLANGUAGE_GERMAN; case wxLANGUAGE_BASQUE: case wxLANGUAGE_CATALAN: case wxLANGUAGE_SPANISH_ARGENTINA: case wxLANGUAGE_SPANISH_BOLIVIA: case wxLANGUAGE_SPANISH_CHILE: case wxLANGUAGE_SPANISH_COLOMBIA: case wxLANGUAGE_SPANISH_COSTA_RICA: case wxLANGUAGE_SPANISH_DOMINICAN_REPUBLIC: case wxLANGUAGE_SPANISH_ECUADOR: case wxLANGUAGE_SPANISH_EL_SALVADOR: case wxLANGUAGE_SPANISH_GUATEMALA: case wxLANGUAGE_SPANISH_HONDURAS: case wxLANGUAGE_SPANISH_MEXICAN: case wxLANGUAGE_SPANISH_NICARAGUA: case wxLANGUAGE_SPANISH_PANAMA: case wxLANGUAGE_SPANISH_PARAGUAY: case wxLANGUAGE_SPANISH_PERU: case wxLANGUAGE_SPANISH_PUERTO_RICO: case wxLANGUAGE_SPANISH_URUGUAY: case wxLANGUAGE_SPANISH_VENEZUELA: return wxLANGUAGE_SPANISH_MODERN; case wxLANGUAGE_ITALIAN_SWISS : return wxLANGUAGE_ITALIAN; case wxLANGUAGE_CORSICAN: case wxLANGUAGE_FRENCH_BELGIAN: case wxLANGUAGE_FRENCH_CANADIAN: case wxLANGUAGE_FRENCH_LUXEMBOURG: case wxLANGUAGE_FRENCH_MONACO: case wxLANGUAGE_FRENCH_SWISS: return wxLANGUAGE_FRENCH; default : break; } return wxLangId; }