From e70f374335a1046328514b4b8c1ca4f02bcb5798 Mon Sep 17 00:00:00 2001 From: "gregory.hainaut@gmail.com" Date: Sat, 22 Jan 2011 14:50:05 +0000 Subject: [PATCH] i18n: on linux seach l10n file also in Langs directory git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4248 96395faa-99c1-11dd-bbfe-3dabce05a288 --- pcsx2/PathDefs.h | 3 +++ pcsx2/gui/AppConfig.cpp | 12 ++++++++++++ pcsx2/gui/AppInit.cpp | 2 +- pcsx2/gui/i18n.cpp | 12 ++++++++++++ pcsx2/gui/i18n.h | 1 + 5 files changed, 29 insertions(+), 1 deletion(-) diff --git a/pcsx2/PathDefs.h b/pcsx2/PathDefs.h index 0cb9377059..e249d834c1 100644 --- a/pcsx2/PathDefs.h +++ b/pcsx2/PathDefs.h @@ -29,6 +29,7 @@ enum FoldersEnum_t FolderId_Savestates, FolderId_MemoryCards, FolderId_Logs, + FolderId_Langs, FolderId_Documents, @@ -56,6 +57,7 @@ namespace PathDefs extern wxDirName GetMemoryCards(); extern wxDirName GetSettings(); extern wxDirName GetLogs(); + extern wxDirName GetLangs(); extern wxDirName Get( FoldersEnum_t folderidx ); @@ -71,6 +73,7 @@ namespace PathDefs extern const wxDirName& Themes(); extern const wxDirName& Logs(); extern const wxDirName& Dumps(); + extern const wxDirName& Langs(); } } diff --git a/pcsx2/gui/AppConfig.cpp b/pcsx2/gui/AppConfig.cpp index b02f6c4aca..ea2c867910 100644 --- a/pcsx2/gui/AppConfig.cpp +++ b/pcsx2/gui/AppConfig.cpp @@ -72,6 +72,12 @@ namespace PathDefs return retval; } + const wxDirName& Langs() + { + static const wxDirName retval( L"Langs" ); + return retval; + } + const wxDirName& Dumps() { static const wxDirName retval( L"dumps" ); @@ -176,6 +182,11 @@ namespace PathDefs return GetDocuments() + Base::Logs(); } + wxDirName GetLangs() + { + return GetDocuments() + Base::Langs(); + } + wxDirName Get( FoldersEnum_t folderidx ) { switch( folderidx ) @@ -188,6 +199,7 @@ namespace PathDefs case FolderId_Savestates: return GetSavestates(); case FolderId_MemoryCards: return GetMemoryCards(); case FolderId_Logs: return GetLogs(); + case FolderId_Langs: return GetLangs(); case FolderId_Documents: return CustomDocumentsFolder; diff --git a/pcsx2/gui/AppInit.cpp b/pcsx2/gui/AppInit.cpp index 336da2a521..e197401913 100644 --- a/pcsx2/gui/AppInit.cpp +++ b/pcsx2/gui/AppInit.cpp @@ -423,7 +423,7 @@ bool Pcsx2App::OnInit() if( !_parent::OnInit() ) return false; Console.WriteLn("Command line parsed!"); - wxLocale::AddCatalogLookupPathPrefix( wxGetCwd() ); + i18n_SetLanguagePath(); #define pxAppMethodEventHandler(func) \ (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(pxInvokeAppMethodEventFunction, &func ) diff --git a/pcsx2/gui/i18n.cpp b/pcsx2/gui/i18n.cpp index 9261befb51..7e638f65e1 100644 --- a/pcsx2/gui/i18n.cpp +++ b/pcsx2/gui/i18n.cpp @@ -245,3 +245,15 @@ bool i18n_SetLanguage( wxLanguage wxLangId, const wxString& langCode ) locale.DetachPtr(); return true; } + +// This method sets the lookup path to search l10n files +void i18n_SetLanguagePath() +{ + // default location for windows + wxLocale::AddCatalogLookupPathPrefix( wxGetCwd() ); + // additional location for linux +#ifdef __LINUX__ + wxLocale::AddCatalogLookupPathPrefix( PathDefs::GetLangs().ToString() ); +#endif + +} diff --git a/pcsx2/gui/i18n.h b/pcsx2/gui/i18n.h index 34c2b578ef..10e513f323 100644 --- a/pcsx2/gui/i18n.h +++ b/pcsx2/gui/i18n.h @@ -38,4 +38,5 @@ typedef std::vector LangPackList; extern bool i18n_SetLanguage( wxLanguage wxLangId, const wxString& langCode=wxEmptyString ); extern void i18n_EnumeratePackages( LangPackList& langs ); extern bool i18n_IsLegacyLanguageId( wxLanguage lang ); +extern void i18n_SetLanguagePath();