From da3a17e912b4e4652541882aecf7360524a56cf6 Mon Sep 17 00:00:00 2001 From: Rajendra Singh Date: Mon, 4 Mar 2019 07:59:54 +0530 Subject: [PATCH] Support More localization Close #5323 --- PowerEditor/installer/nativeLang/english.xml | 12 ++++++++ PowerEditor/installer/nativeLang/hindi.xml | 30 +++++++++++++------ PowerEditor/src/NppIO.cpp | 5 +++- .../ScitillaComponent/UserDefineDialog.cpp | 30 +++++++++++++++---- .../WinControls/Preference/preferenceDlg.cpp | 18 ++++++++--- 5 files changed, 75 insertions(+), 20 deletions(-) diff --git a/PowerEditor/installer/nativeLang/english.xml b/PowerEditor/installer/nativeLang/english.xml index b747c91e..d1950c83 100644 --- a/PowerEditor/installer/nativeLang/english.xml +++ b/PowerEditor/installer/nativeLang/english.xml @@ -1197,6 +1197,18 @@ Do you want to launch Notepad++ in Administrator mode?"/> + + + + + + + + + + + + diff --git a/PowerEditor/installer/nativeLang/hindi.xml b/PowerEditor/installer/nativeLang/hindi.xml index dedb94f4..ba714382 100644 --- a/PowerEditor/installer/nativeLang/hindi.xml +++ b/PowerEditor/installer/nativeLang/hindi.xml @@ -157,7 +157,7 @@ - + @@ -227,7 +227,7 @@ - + @@ -391,8 +391,8 @@ - - + + @@ -614,7 +614,7 @@ - + @@ -865,7 +865,7 @@ - + @@ -926,8 +926,8 @@ - - + + @@ -1074,7 +1074,7 @@ - + @@ -1190,6 +1190,18 @@ + + + + + + + + + + + + diff --git a/PowerEditor/src/NppIO.cpp b/PowerEditor/src/NppIO.cpp index 7feb90fe..2abdb8bf 100644 --- a/PowerEditor/src/NppIO.cpp +++ b/PowerEditor/src/NppIO.cpp @@ -1412,8 +1412,11 @@ bool Notepad_plus::fileRename(BufferID id) // Reserved characters: < > : " / \ | ? * std::wstring reservedChars = TEXT("<>:\"/\\|\?*"); + generic_string title = _nativeLangSpeaker.getLocalizedStrFromID("tabrename-title", TEXT("Rename Current Tab")); + generic_string staticName = _nativeLangSpeaker.getLocalizedStrFromID("tabrename-newname", TEXT("New Name: ")); + StringDlg strDlg; - strDlg.init(_pPublicInterface->getHinst(), _pPublicInterface->getHSelf(), TEXT("Rename Current Tab"), TEXT("New Name : "), buf->getFileName(), 0, reservedChars.c_str(), true); + strDlg.init(_pPublicInterface->getHinst(), _pPublicInterface->getHSelf(), title.c_str(), staticName.c_str(), buf->getFileName(), 0, reservedChars.c_str(), true); TCHAR *tabNewName = reinterpret_cast(strDlg.doDialog()); if (tabNewName) diff --git a/PowerEditor/src/ScitillaComponent/UserDefineDialog.cpp b/PowerEditor/src/ScitillaComponent/UserDefineDialog.cpp index d5a9b1c3..709b8f8e 100644 --- a/PowerEditor/src/ScitillaComponent/UserDefineDialog.cpp +++ b/PowerEditor/src/ScitillaComponent/UserDefineDialog.cpp @@ -948,6 +948,7 @@ void UserDefineDialog::updateDlg() INT_PTR CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) { NppParameters *pNppParam = NppParameters::getInstance(); + NativeLangSpeaker * pNativeSpeaker = pNppParam->getNativeLangSpeaker(); switch (message) { @@ -1176,8 +1177,11 @@ INT_PTR CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPAR ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_GETLBTEXT, i, reinterpret_cast(langName)); + generic_string strName = pNativeSpeaker->getLocalizedStrFromID("common-name", TEXT("Name: ")); + generic_string strTitle = pNativeSpeaker->getLocalizedStrFromID("userdefined-title-rename", TEXT("Rename Current Language Name")); + StringDlg strDlg; - strDlg.init(_hInst, _hSelf, TEXT("Rename Current Language Name"), TEXT("Name : "), langName, langNameLenMax-1); + strDlg.init(_hInst, _hSelf, strTitle.c_str(), strName.c_str(), langName, langNameLenMax - 1); TCHAR *newName = (TCHAR *)strDlg.doDialog(); @@ -1221,11 +1225,14 @@ INT_PTR CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPAR if (i == 0) wParam = IDC_ADDNEW_BUTTON; + + generic_string strName = pNativeSpeaker->getLocalizedStrFromID("common-name", TEXT("Name: ")); + generic_string strTitle = (wParam == IDC_SAVEAS_BUTTON) ? + pNativeSpeaker->getLocalizedStrFromID("userdefined-title-save", TEXT("Save Current Language Name As...")) : + pNativeSpeaker->getLocalizedStrFromID("userdefined-title-new", TEXT("Create New Language...")); + StringDlg strDlg; - if (wParam == IDC_SAVEAS_BUTTON) - strDlg.init(_hInst, _hSelf, TEXT("Save Current Language Name As..."), TEXT("Name : "), TEXT(""), langNameLenMax-1); - else - strDlg.init(_hInst, _hSelf, TEXT("Create New Language..."), TEXT("Name : "), TEXT(""), langNameLenMax-1); + strDlg.init(_hInst, _hSelf, strTitle.c_str(), strName.c_str(), TEXT(""), langNameLenMax - 1); TCHAR *tmpName = reinterpret_cast(strDlg.doDialog()); @@ -1236,7 +1243,7 @@ INT_PTR CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPAR if (pNppParam->isExistingUserLangName(newName)) { - pNppParam->getNativeLangSpeaker()->messageBox("UDLNewNameError", + pNativeSpeaker->messageBox("UDLNewNameError", _hSelf, TEXT("This name is used by another language,\rplease give another one."), TEXT("UDL Error"), @@ -1456,6 +1463,17 @@ INT_PTR CALLBACK StringDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM) if (_txtLen) ::SendDlgItemMessage(_hSelf, IDC_STRING_EDIT, EM_SETLIMITTEXT, _txtLen, 0); + // localization for OK and Cancel + NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); + if (pNativeSpeaker) + { + generic_string ok = pNativeSpeaker->getLocalizedStrFromID("common-ok", TEXT("OK")); + generic_string cancel = pNativeSpeaker->getLocalizedStrFromID("common-cancel", TEXT("Cancel")); + + ::SetDlgItemText(_hSelf, IDOK, ok.c_str()); + ::SetDlgItemText(_hSelf, IDCANCEL, cancel.c_str()); + } + if (_shouldGotoCenter) goToCenter(); diff --git a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp index d4594630..ba03e15f 100644 --- a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp +++ b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp @@ -810,8 +810,11 @@ INT_PTR CALLBACK MarginsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPa { ScintillaViewParams & svp = (ScintillaViewParams &)pNppParam->getSVP(); + NativeLangSpeaker *pNativeSpeaker = pNppParam->getNativeLangSpeaker(); + generic_string strNbCol = pNativeSpeaker->getLocalizedStrFromID("edit-verticaledge-nb-col", TEXT("Nb of column:")); + ValueDlg nbColumnEdgeDlg; - nbColumnEdgeDlg.init(NULL, _hSelf, svp._edgeNbColumn, TEXT("Nb of column:")); + nbColumnEdgeDlg.init(NULL, _hSelf, svp._edgeNbColumn, strNbCol.c_str()); nbColumnEdgeDlg.setNBNumber(3); POINT p; @@ -1417,6 +1420,7 @@ INT_PTR CALLBACK RecentFilesHistoryDlg::run_dlgProc(UINT message, WPARAM wParam, { NppParameters *pNppParam = NppParameters::getInstance(); NppGUI & nppGUI = (NppGUI & )pNppParam->getNppGUI(); + NativeLangSpeaker *pNativeSpeaker = pNppParam->getNativeLangSpeaker(); switch (message) { @@ -1474,8 +1478,9 @@ INT_PTR CALLBACK RecentFilesHistoryDlg::run_dlgProc(UINT message, WPARAM wParam, case IDC_MAXNBFILEVAL_STATIC: { + generic_string staticText = pNativeSpeaker->getLocalizedStrFromID("recent-file-history-maxfile", TEXT("Max File: ")); ValueDlg nbFileMaxDlg; - nbFileMaxDlg.init(NULL, _hSelf, pNppParam->getNbMaxRecentFile(), TEXT("Max File: ")); + nbFileMaxDlg.init(NULL, _hSelf, pNppParam->getNbMaxRecentFile(), staticText.c_str()); POINT p; ::GetCursorPos(&p); @@ -1552,6 +1557,7 @@ INT_PTR CALLBACK LangMenuDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP { NppParameters *pNppParam = NppParameters::getInstance(); NppGUI & nppGUI = const_cast(pNppParam->getNppGUI()); + NativeLangSpeaker *pNativeSpeaker = pNppParam->getNativeLangSpeaker(); switch (message) { @@ -1838,8 +1844,9 @@ INT_PTR CALLBACK LangMenuDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP // case IDC_TABSIZEVAL_STATIC: { + generic_string staticText = pNativeSpeaker->getLocalizedStrFromID("language-tabsize", TEXT("Tab Size: ")); ValueDlg tabSizeDlg; - tabSizeDlg.init(_hInst, _hParent, nppGUI._tabSize, TEXT("Tab Size : ")); + tabSizeDlg.init(_hInst, _hParent, nppGUI._tabSize, staticText.c_str()); POINT p; ::GetCursorPos(&p); int size = tabSizeDlg.doDialog(p); @@ -2836,8 +2843,11 @@ INT_PTR CALLBACK AutoCompletionDlg::run_dlgProc(UINT message, WPARAM wParam, LPA const int NB_MIN_CHAR = 1; const int NB_MAX_CHAR = 9; + NativeLangSpeaker *pNativeSpeaker = pNppParam->getNativeLangSpeaker(); + generic_string strNbChar = pNativeSpeaker->getLocalizedStrFromID("autocomplete-nb-char", TEXT("Nb char : ")); + ValueDlg valDlg; - valDlg.init(NULL, _hSelf, static_cast(nppGUI._autocFromLen), TEXT("Nb char : ")); + valDlg.init(NULL, _hSelf, static_cast(nppGUI._autocFromLen), strNbChar.c_str()); valDlg.setNBNumber(1); POINT p;