Fix an issue relative to the env vars initializations on Linux: they are not initialized if the value contains any non ASCII7 char, and if the locale is not set.
The locale is now set before reading the env vars configuration.
This commit is contained in:
parent
0fa71d8d8f
commit
624c508dda
|
@ -488,10 +488,13 @@ bool PGM_BASE::initPgm()
|
|||
|
||||
ReadPdfBrowserInfos(); // needs m_common_settings
|
||||
|
||||
loadCommonSettings();
|
||||
|
||||
// Init user language *before* calling loadCommonSettings, because
|
||||
// env vars could be incorrectly initialized on Linux
|
||||
// (if the value contains some non ASCII7 chars, the env var is not initialized)
|
||||
SetLanguage( true );
|
||||
|
||||
loadCommonSettings();
|
||||
|
||||
// Set locale option for separator used in float numbers
|
||||
SetLocaleTo_Default();
|
||||
|
||||
|
@ -553,23 +556,8 @@ void PGM_BASE::loadCommonSettings()
|
|||
m_help_size.x = 500;
|
||||
m_help_size.y = 400;
|
||||
|
||||
wxString languageSel;
|
||||
|
||||
m_common_settings->Read( languageCfgKey, &languageSel );
|
||||
setLanguageId( wxLANGUAGE_DEFAULT );
|
||||
|
||||
m_common_settings->Read( showEnvVarWarningDialog, &m_show_env_var_dialog );
|
||||
|
||||
// Search for the current selection
|
||||
for( unsigned ii = 0; ii < DIM( s_Languages ); ii++ )
|
||||
{
|
||||
if( s_Languages[ii].m_Lang_Label == languageSel )
|
||||
{
|
||||
setLanguageId( s_Languages[ii].m_WX_Lang_Identifier );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
m_editor_name = m_common_settings->Read( wxT( "Editor" ) );
|
||||
|
||||
wxString entry, oldPath;
|
||||
|
@ -629,6 +617,26 @@ bool PGM_BASE::SetLanguage( bool first_time )
|
|||
{
|
||||
bool retv = true;
|
||||
|
||||
if( first_time )
|
||||
{
|
||||
setLanguageId( wxLANGUAGE_DEFAULT );
|
||||
// First time SetLanguage is called, the user selected language id is set
|
||||
// from commun user config settings
|
||||
wxString languageSel;
|
||||
|
||||
m_common_settings->Read( languageCfgKey, &languageSel );
|
||||
|
||||
// Search for the current selection
|
||||
for( unsigned ii = 0; ii < DIM( s_Languages ); ii++ )
|
||||
{
|
||||
if( s_Languages[ii].m_Lang_Label == languageSel )
|
||||
{
|
||||
setLanguageId( s_Languages[ii].m_WX_Lang_Identifier );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// dictionary file name without extend (full name is kicad.mo)
|
||||
wxString dictionaryName( wxT( "kicad" ) );
|
||||
|
||||
|
@ -652,9 +660,12 @@ bool PGM_BASE::SetLanguage( bool first_time )
|
|||
GetChars( dictionaryName ), GetChars( m_locale->GetName() ) );
|
||||
}
|
||||
|
||||
// how about a meaningful comment here.
|
||||
if( !first_time )
|
||||
{
|
||||
// If we are here, the user has selected an other language.
|
||||
// Therefore the new prefered language name is stored in common config.
|
||||
// Do NOT store the wxWidgets language Id, it can change between wxWidgets
|
||||
// versions, for a given language
|
||||
wxString languageSel;
|
||||
|
||||
// Search for the current selection
|
||||
|
|
Loading…
Reference in New Issue