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
This commit is contained in:
gregory.hainaut@gmail.com 2011-01-22 14:50:05 +00:00
parent b24ffa885c
commit e70f374335
5 changed files with 29 additions and 1 deletions

View File

@ -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();
}
}

View File

@ -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;

View File

@ -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 )

View File

@ -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
}

View File

@ -38,4 +38,5 @@ typedef std::vector<LangPackEnumeration> 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();