[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
This commit is contained in:
Don Ho 2011-03-29 22:10:02 +00:00
parent 0152ded3ff
commit 88a2393e43

View File

@ -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) BOOL CALLBACK BarsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
{ {
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters *pNppParam = NppParameters::getInstance();
switch (Message) switch (Message)
{ {
case WM_INITDIALOG : case WM_INITDIALOG :
@ -228,11 +229,15 @@ BOOL CALLBACK BarsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
pair<wstring, wstring> localizationInfo = localizationSwitcher.getElementFromIndex(i); pair<wstring, wstring> localizationInfo = localizationSwitcher.getElementFromIndex(i);
::SendDlgItemMessage(_hSelf, IDC_COMBO_LOCALIZATION, CB_ADDSTRING, 0, (LPARAM)localizationInfo.first.c_str()); ::SendDlgItemMessage(_hSelf, IDC_COMBO_LOCALIZATION, CB_ADDSTRING, 0, (LPARAM)localizationInfo.first.c_str());
} }
string fn = localizationSwitcher.getFileName(); wstring lang = TEXT("English"); // Set default language as Englishs
wstring fnW(fn.begin(), fn.end()); if (pNppParam->getNativeLangA()) // if nativeLangA is not NULL, then we can be sure the default language (English) is not used
fnW.assign(fn.begin(), fn.end()); {
wstring lang = localizationSwitcher.getLangFromXmlFileName(fnW.c_str()); string fn = localizationSwitcher.getFileName();
int index = ::SendDlgItemMessage(_hSelf, IDC_COMBO_LOCALIZATION, CB_FINDSTRINGEXACT, (WPARAM)-1, (LPARAM)lang.c_str()); 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) if (index != CB_ERR)
::SendDlgItemMessage(_hSelf, IDC_COMBO_LOCALIZATION, CB_SETCURSEL, index, 0); ::SendDlgItemMessage(_hSelf, IDC_COMBO_LOCALIZATION, CB_SETCURSEL, index, 0);
#endif #endif