Example #1
0
/** Save all the languages settings.
 */
void CodeStatConfigDlg::SaveSettings()
{
    // Delete the old keys
    ConfigManager* cfg = Manager::Get()->GetConfigManager(_T("codestat"));
    cfg->Delete();

    // Save current language settings
    SaveCurrentLanguage();

    // Save settings
    cfg = Manager::Get()->GetConfigManager(_T("codestat"));
    cfg->Write(_T("/nb_languages"), nb_languages);
    for (int i=0; i<nb_languages; ++i)
    {
        wxString extensions;
        cfg->Write(wxString::Format(_T("/l%d/name"),i), languages[i].name);
        for (unsigned int j=0; j<languages[i].ext.Count(); ++j)
        {
           extensions = extensions + languages[i].ext[j] + _T(" ");
        }
        cfg->Write(wxString::Format(_T("/l%d/ext"),i), extensions);
        cfg->Write(wxString::Format(_T("/l%d/single_line_comment"),i), languages[i].single_line_comment);
        cfg->Write(wxString::Format(_T("/l%d/multiple_line_comment_begin"),i), languages[i].multiple_line_comment[0]);
        cfg->Write(wxString::Format(_T("/l%d/multiple_line_comment_end"),i), languages[i].multiple_line_comment[1]);
    }
}
void LanguageTable::LoadCurrentLanguage()
{
	if( !m_lang )
	{
		char *interfaceLanguage = g_preferences->GetString( PREFS_INTERFACE_LANGUAGE, "english" );

		AppReleaseAssert( interfaceLanguage, "Couldn't find language preference '%s'", PREFS_INTERFACE_LANGUAGE );

		if( !GetLanguageSelectable( interfaceLanguage ) )
		{
			interfaceLanguage = m_defaultLanguage;
		}

		for( int i = 0; i < m_languages.Size(); i++ )
		{
			Language *thisLang = m_languages.GetData( i );
			if( stricmp( thisLang->m_name, interfaceLanguage ) == 0 )
			{
				m_lang = new Language( *thisLang );
				break;
			}
		}

		AppReleaseAssert( m_lang, "Couldn't find language '%s'", interfaceLanguage );
	}
	
    g_languageTable->LoadBaseLanguage( "data/language/english.txt" );
	if( stricmp( m_lang->m_name, "english" ) != 0 )
	{
		g_languageTable->LoadTranslation( m_lang->m_path );
	}

	SaveCurrentLanguage( m_lang );
}
Example #3
0
/** Save the current language settings and print the caracteristics for the language selected.
 */
void CodeStatConfigDlg::ComboBoxEvent(wxCommandEvent & event)
{
    SaveCurrentLanguage();
	PrintLanguageInfo(event.GetSelection());
}