[BUG_FIXED] Fix Language Switcher not working bug while localization command option is used.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1085 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2013-07-25 23:22:13 +00:00
parent 1a534cd927
commit 7465e1dc8f
2 changed files with 7 additions and 14 deletions

View File

@ -748,12 +748,7 @@ bool NppParameters::reloadStylers(TCHAR *stylePath)
bool NppParameters::reloadLang() bool NppParameters::reloadLang()
{ {
// use user path // use user path
#ifdef UNICODE
generic_string nativeLangPath(_localizationSwitcher._nativeLangPath); generic_string nativeLangPath(_localizationSwitcher._nativeLangPath);
#else
generic_string nativeLangPath(_userPath);
PathAppend(nativeLangPath, generic_string(TEXT("nativeLang.xml")));
#endif
// if "nativeLang.xml" does not exist, use npp path // if "nativeLang.xml" does not exist, use npp path
if (!PathFileExists(nativeLangPath.c_str())) if (!PathFileExists(nativeLangPath.c_str()))
@ -989,21 +984,21 @@ bool NppParameters::load()
//----------------------------------------------// //----------------------------------------------//
generic_string nativeLangPath; generic_string nativeLangPath;
nativeLangPath = _userPath;
PathAppend(nativeLangPath, TEXT("nativeLang.xml"));
// LocalizationSwitcher should use always user path
_localizationSwitcher._nativeLangPath = nativeLangPath;
if (_startWithLocFileName != TEXT("")) // localization argument detected, use user wished localization if (_startWithLocFileName != TEXT("")) // localization argument detected, use user wished localization
{ {
// overwrite nativeLangPath variable
nativeLangPath = _nppPath; nativeLangPath = _nppPath;
PathAppend(nativeLangPath, TEXT("localization\\")); PathAppend(nativeLangPath, TEXT("localization\\"));
PathAppend(nativeLangPath, _startWithLocFileName); PathAppend(nativeLangPath, _startWithLocFileName);
} }
else // use %appdata% location, or (if absence then) npp installed location else // use %appdata% location, or (if absence then) npp installed location
{ {
nativeLangPath = _userPath;
PathAppend(nativeLangPath, TEXT("nativeLang.xml"));
// LocalizationSwitcher should use always user path
_localizationSwitcher._nativeLangPath = nativeLangPath;
if (!PathFileExists(nativeLangPath.c_str())) if (!PathFileExists(nativeLangPath.c_str()))
{ {
nativeLangPath = _nppPath; nativeLangPath = _nppPath;

View File

@ -478,7 +478,6 @@ BOOL CALLBACK BarsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
{ {
case IDC_COMBO_LOCALIZATION : case IDC_COMBO_LOCALIZATION :
{ {
#ifdef UNICODE
LocalizationSwitcher & localizationSwitcher = pNppParam->getLocalizationSwitcher(); LocalizationSwitcher & localizationSwitcher = pNppParam->getLocalizationSwitcher();
int index = ::SendDlgItemMessage(_hSelf, IDC_COMBO_LOCALIZATION, CB_GETCURSEL, 0, 0); int index = ::SendDlgItemMessage(_hSelf, IDC_COMBO_LOCALIZATION, CB_GETCURSEL, 0, 0);
wchar_t langName[MAX_PATH]; wchar_t langName[MAX_PATH];
@ -498,7 +497,6 @@ BOOL CALLBACK BarsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
::InvalidateRect(_hParent, NULL, TRUE); ::InvalidateRect(_hParent, NULL, TRUE);
} }
} }
#endif
} }
return TRUE; return TRUE;
default: default: