diff --git a/common/paths.cpp b/common/paths.cpp index cd46f2a6c5..fc2158f668 100644 --- a/common/paths.cpp +++ b/common/paths.cpp @@ -249,6 +249,16 @@ wxString PATHS::GetStockTemplatesPath() } +wxString PATHS::GetLocaleDataPath() +{ + wxString path; + + path = GetStockDataPath() + wxT( "/internat" ); + + return path; +} + + wxString PATHS::GetStockPluginsPath() { wxFileName fn; diff --git a/common/pgm_base.cpp b/common/pgm_base.cpp index 5ff678b7bf..c9ac0fa492 100644 --- a/common/pgm_base.cpp +++ b/common/pgm_base.cpp @@ -57,6 +57,7 @@ #include #include #include +#include /** @@ -544,48 +545,7 @@ void PGM_BASE::SetLanguageIdentifier( int menu_id ) void PGM_BASE::SetLanguagePath() { - SEARCH_STACK guesses; - - SystemDirsAppend( &guesses ); - - // Add our internat dir to the wxLocale catalog of paths - for( unsigned i = 0; i < guesses.GetCount(); i++ ) - { - wxFileName fn( guesses[i], wxEmptyString ); - - // Append path for Windows and unix KiCad package install - fn.AppendDir( "share" ); - fn.AppendDir( "internat" ); - - if( fn.IsDirReadable() ) - { - wxLogTrace( traceLocale, "Adding locale lookup path: " + fn.GetPath() ); - wxLocale::AddCatalogLookupPathPrefix( fn.GetPath() ); - } - - // Append path for unix standard install - fn.RemoveLastDir(); - fn.AppendDir( "kicad" ); - fn.AppendDir( "internat" ); - - if( fn.IsDirReadable() ) - { - wxLogTrace( traceLocale, "Adding locale lookup path: " + fn.GetPath() ); - wxLocale::AddCatalogLookupPathPrefix( fn.GetPath() ); - } - - // Append path for macOS install - fn.RemoveLastDir(); - fn.RemoveLastDir(); - fn.RemoveLastDir(); - fn.AppendDir( "internat" ); - - if( fn.IsDirReadable() ) - { - wxLogTrace( traceLocale, "Adding locale lookup path: " + fn.GetPath() ); - wxLocale::AddCatalogLookupPathPrefix( fn.GetPath() ); - } - } + wxLocale::AddCatalogLookupPathPrefix( PATHS::GetLocaleDataPath() ); if( wxGetEnv( wxT( "KICAD_RUN_FROM_BUILD_DIR" ), nullptr ) ) { diff --git a/include/paths.h b/include/paths.h index 25e2a0510f..df3cd4e031 100644 --- a/include/paths.h +++ b/include/paths.h @@ -126,6 +126,11 @@ public: */ static wxString GetStockTemplatesPath(); + /** + * Gets the locales translation data path + */ + static wxString GetLocaleDataPath(); + /** * Gets the stock (install) 3d viewer plugins path */