From 88a2393e4398c2fe91beeab991edb450adeb58dc Mon Sep 17 00:00:00 2001 From: Don Ho Date: Tue, 29 Mar 2011 22:10:02 +0000 Subject: [PATCH] [BUG_FIXED] Fix English not shown in Preferences dialog bug on the absence of nativeLang.xml. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@743 f5eea248-9336-0410-98b8-ebc06183d4e3 --- .../src/WinControls/Preference/preferenceDlg.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp index 34a8a4d4..fade0b65 100644 --- a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp +++ b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp @@ -175,6 +175,7 @@ BOOL CALLBACK PreferenceDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPa BOOL CALLBACK BarsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM) { NppParameters *pNppParam = NppParameters::getInstance(); + switch (Message) { case WM_INITDIALOG : @@ -228,11 +229,15 @@ BOOL CALLBACK BarsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM) pair localizationInfo = localizationSwitcher.getElementFromIndex(i); ::SendDlgItemMessage(_hSelf, IDC_COMBO_LOCALIZATION, CB_ADDSTRING, 0, (LPARAM)localizationInfo.first.c_str()); } - string fn = localizationSwitcher.getFileName(); - wstring fnW(fn.begin(), fn.end()); - fnW.assign(fn.begin(), fn.end()); - wstring lang = localizationSwitcher.getLangFromXmlFileName(fnW.c_str()); - int index = ::SendDlgItemMessage(_hSelf, IDC_COMBO_LOCALIZATION, CB_FINDSTRINGEXACT, (WPARAM)-1, (LPARAM)lang.c_str()); + wstring lang = TEXT("English"); // Set default language as Englishs + if (pNppParam->getNativeLangA()) // if nativeLangA is not NULL, then we can be sure the default language (English) is not used + { + string fn = localizationSwitcher.getFileName(); + wstring fnW(fn.begin(), fn.end()); + fnW.assign(fn.begin(), fn.end()); + lang = localizationSwitcher.getLangFromXmlFileName(fnW.c_str()); + } + int index = ::SendDlgItemMessage(_hSelf, IDC_COMBO_LOCALIZATION, CB_FINDSTRINGEXACT, (WPARAM)-1, (LPARAM)lang.c_str()); if (index != CB_ERR) ::SendDlgItemMessage(_hSelf, IDC_COMBO_LOCALIZATION, CB_SETCURSEL, index, 0); #endif