bool WinEDA_App::SetLanguage(bool first_time) /*********************************************/ /* Set the dictionary file name for internationalization the files are in kicad/internat/xx or kicad/internat/xx_XX and are named kicad.mo */ { wxString DictionaryName( wxT("kicad")); // dictionary file name without extend (full name is kicad.mo) wxString BaseDictionaryPath( wxT("internat")); // Real path is kicad/internat/xx_XX or kicad/internat/xx wxString dic_path; if ( m_Locale != NULL ) delete m_Locale; m_Locale = new wxLocale(); m_Locale->Init(m_LanguageId); dic_path = ReturnKicadDatasPath() + BaseDictionaryPath; m_Locale->AddCatalogLookupPathPrefix(dic_path); if ( ! first_time ) { if ( m_EDA_CommonConfig ) m_EDA_CommonConfig->Write( wxT("Language"), m_LanguageId); } if ( ! m_Locale->IsLoaded(DictionaryName) ) m_Locale->AddCatalog(DictionaryName); SetLanguageList(NULL); if ( atof("0,1") ) g_FloatSeparator = ','; // Nombres flottants = 0,1 else g_FloatSeparator = '.'; return m_Locale->IsOk(); }
bool EDA_APP::SetLanguage( bool first_time ) { bool retv = true; // dictionary file name without extend (full name is kicad.mo) wxString DictionaryName( wxT( "kicad" ) ); if( m_Locale ) delete m_Locale; m_Locale = new wxLocale; #if wxCHECK_VERSION( 2, 9, 0 ) if( !m_Locale->Init( m_LanguageId ) ) #else if( !m_Locale->Init( m_LanguageId, wxLOCALE_CONV_ENCODING ) ) #endif { wxLogDebug( wxT( "This language is not supported by the system." ) ); m_LanguageId = wxLANGUAGE_DEFAULT; delete m_Locale; m_Locale = new wxLocale; m_Locale->Init(); retv = false; } else if( !first_time ) { wxLogDebug( wxT( "Search for dictionary %s.mo in %s" ), GetChars( DictionaryName ), GetChars( m_Locale->GetName() ) ); } if( !first_time ) { wxString languageSel; // Search for the current selection for( unsigned int ii = 0; ii < LANGUAGE_DESCR_COUNT; ii++ ) { if( s_Language_List[ii].m_WX_Lang_Identifier == m_LanguageId ) { languageSel = s_Language_List[ii].m_Lang_Label; break; } } m_commonSettings->Write( languageCfgKey, languageSel ); } // Test if floating point notation is working (bug in cross compilation, using wine) // Make a conversion double <=> string double dtst = 0.5; wxString msg; extern bool g_DisableFloatingPointLocalNotation; // See common.cpp g_DisableFloatingPointLocalNotation = false; msg << dtst; double result; msg.ToDouble(&result); if( result != dtst ) // string to double encode/decode does not work! Bug detected { // Disable floating point localization: g_DisableFloatingPointLocalNotation = true; SetLocaleTo_C_standard( ); } if( !m_Locale->IsLoaded( DictionaryName ) ) m_Locale->AddCatalog( DictionaryName ); if( !retv ) return retv; return m_Locale->IsOk(); }