Simplify locale data path setting...

This commit is contained in:
Marek Roszko 2022-02-21 13:04:08 -05:00
parent ad251b7b8c
commit 0b46c75197
3 changed files with 17 additions and 42 deletions

View File

@ -249,6 +249,16 @@ wxString PATHS::GetStockTemplatesPath()
}
wxString PATHS::GetLocaleDataPath()
{
wxString path;
path = GetStockDataPath() + wxT( "/internat" );
return path;
}
wxString PATHS::GetStockPluginsPath()
{
wxFileName fn;

View File

@ -57,6 +57,7 @@
#include <settings/settings_manager.h>
#include <systemdirsappend.h>
#include <trace_helpers.h>
#include <paths.h>
/**
@ -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 ) )
{

View File

@ -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
*/