/[pcsx2_0.9.7]/trunk/pcsx2/gui/Panels/MiscPanelStuff.cpp
ViewVC logotype

Diff of /trunk/pcsx2/gui/Panels/MiscPanelStuff.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- trunk/pcsx2/gui/Panels/MiscPanelStuff.cpp	2010/12/23 11:48:33	279
+++ trunk/pcsx2/gui/Panels/MiscPanelStuff.cpp	2010/12/23 12:02:12	280
@@ -32,13 +32,13 @@
 Panels::DocsFolderPickerPanel::DocsFolderPickerPanel( wxWindow* parent, bool isFirstTime )
 	: BaseApplicableConfigPanel( parent, wxVERTICAL, _("Usermode Selection") )
 {
-	const wxString usermodeExplained( pxE( ".Panel:Usermode:Explained",
+	const wxString usermodeExplained( pxE( "!Panel:Usermode:Explained",
 		L"Please select your preferred default location for PCSX2 user-level documents below "
 		L"(includes memory cards, screenshots, settings, and savestates).  "
 		L"These folder locations can be overridden at any time using the Core Settings panel."
 	) );
 
-	const wxString usermodeWarning( pxE( ".Panel:Usermode:Warning",
+	const wxString usermodeWarning( pxE( "!Panel:Usermode:Warning",
 		L"You can change the preferred default location for PCSX2 user-level documents here "
 		L"(includes memory cards, screenshots, settings, and savestates).  "
 		L"This option only affects Standard Paths which are set to use the installation default value."
@@ -113,26 +113,32 @@
 	i18n_EnumeratePackages( m_langs );
 
 	int size = m_langs.size();
-	int cursel = 0;
-	ScopedArray<wxString> compiled( size ); //, L"Compiled Language Names" );
-	wxString configLangName( wxLocale::GetLanguageName( wxLANGUAGE_DEFAULT ) );
+	ScopedArray<wxString> compiled( size );
 
 	for( int i=0; i<size; ++i )
-	{
-		compiled[i].Printf( L"%s", m_langs[i].englishName.c_str() ); //, xltNames[i].c_str() );
-		if( m_langs[i].englishName == configLangName )
-			cursel = i;
-	}
+		compiled[i].Printf( L"%s", m_langs[i].englishName.c_str() );
 
 	m_picker = new wxComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize,
 		size, compiled.GetPtr(), wxCB_READONLY | wxCB_SORT );
 
-	*this	+= Label(_("Select a language: (unimplemented)")) | pxMiddle;
+	wxButton* applyButton = new wxButton( this, pxID_RestartWizard, _("Apply") );
+	applyButton->SetToolTip(_("Make this language my default right now!"));
+
+	*this	+= Label(_("Select a language:")) | pxMiddle;
 	*this	+= 5;
 	*this	+= m_picker | pxSizerFlags::StdSpace();
+	*this	+= 5;
+	*this	+= applyButton | pxSizerFlags::StdSpace();
 
-	m_picker->SetSelection( cursel );
-	//AppStatusEvent_OnSettingsApplied();
+	Connect( pxID_RestartWizard,	wxEVT_COMMAND_BUTTON_CLICKED,	wxCommandEventHandler( LanguageSelectionPanel::OnApplyLanguage_Clicked ) );
+
+	m_picker->SetSelection( 0 );		// always default to System Default
+}
+
+void Panels::LanguageSelectionPanel::OnApplyLanguage_Clicked( wxCommandEvent& evt )
+{
+	evt.Skip();
+	Apply();
 }
 
 void Panels::LanguageSelectionPanel::Apply()
@@ -144,19 +150,39 @@
 
 	wxString sel( m_picker->GetString( m_picker->GetSelection() ) );
 
-	g_Conf->LanguageId = wxLANGUAGE_DEFAULT;	// use this if no matches found
+	g_Conf->LanguageCode = L"default";	// use this if no matches found
+	g_Conf->LanguageId = wxLANGUAGE_DEFAULT; 
 	int size = m_langs.size();
 	for( int i=0; i<size; ++i )
 	{
 		if( m_langs[i].englishName == sel )
 		{
-			g_Conf->LanguageId = m_langs[i].wxLangId;
+			if( i18n_SetLanguage( m_langs[i].wxLangId, m_langs[i].canonicalName ) )
+			{
+				g_Conf->LanguageCode = m_langs[i].canonicalName;
+				g_Conf->LanguageId = m_langs[i].wxLangId;
+			}
 			break;
 		}
 	}
+
 }
 
 void Panels::LanguageSelectionPanel::AppStatusEvent_OnSettingsApplied()
 {
-	if( m_picker ) m_picker->SetSelection( g_Conf->LanguageId );
+	if (m_picker)
+	{
+		m_picker->SetSelection( 0 );		// always default to System Default
+
+		if (g_Conf->LanguageCode.IsEmpty())
+			g_Conf->LanguageCode = L"default";
+
+		for (uint i=0; i<m_langs.size(); ++i)
+		{
+			if (0==m_langs[i].canonicalName.CmpNoCase(g_Conf->LanguageCode))
+			{
+				m_picker->SetSelection( i );
+			}
+		}
+	}
 }

 

  ViewVC Help
Powered by ViewVC 1.1.22