Add more translations

Find dialog status bar messages are translatable.
Add more shortcut mapper translation entries.
This commit is contained in:
Don HO 2018-02-14 10:02:55 +01:00
parent 360d45db1a
commit 213af53389
10 changed files with 264 additions and 141 deletions

View File

@ -452,6 +452,7 @@
<Item id="2602" name="Modify"/>
<Item id="2603" name="Delete"/>
<Item id="2606" name="Clear"/>
<Item id="2607" name="Filter: "/>
<Item id="1" name="Close"/>
<ColumnName name="Name"/>
<ColumnShortcut name="Shortcut"/>
@ -462,6 +463,8 @@
<RunCommandsTab name="Run commands"/>
<PluginCommandsTab name="Plugin commands"/>
<ScintillaCommandsTab name="Scintilla commands"/>
<ConflictInfoOk name="No shortcut conflicts for this item."/>
<ConflictInfoEditing name="No conflicts . . ."/>
</ShortcutMapper>
<ShortcutMapperSubDialg title="Shortcut">
<Item id="1" name="OK"/>
@ -1107,8 +1110,39 @@ please give another one."/>
<word-chars-list-warning-end value=" in your character list."/>
<cloud-invalid-warning value="Invalid path."/>
<cloud-restart-warning value="Please restart Notepad++ to take effect."/>
<cloud-select-folder value="Select a folder from/to where Notepad++ reads/writes its settings"/>
<shift-change-direction-tip value="Use Shift + Enter to search in the opposite direction"/>
<two-find-buttons-tip value="2 find buttons mode"/>
<find-status-top-reached value="Find: Found the 1st occurrence from the bottom. The beginning of the document has been reached."/>
<find-status-end-reached value="Find: Found the 1st occurrence from the top. The end of the document has been reached."/>
<find-status-find-from-top-end-reached value="Find: Found the 1st occurrence from the top. The end of document has been reached"/>
<find-status-find-from-bottom-begin-reached value="Find: Found the 1st occurrence from the bottom. The begin of document has been reached"/>
<find-status-replaceinfiles-1-replaced value="Replace in Files: 1 occurrence was replaced"/>
<find-status-replaceinfiles-nb-replaced value="Replace in Files: $INT_REPLACE$ occurrences were replaced"/>
<find-status-replaceinfiles-re-malformed value="Replace in Opened Files: The regular expression is malformed"/>
<find-status-replaceinopenedfiles-1-replaced value="Replace in Opened Files: 1 occurrence was replaced"/>
<find-status-replaceinopenedfiles-nb-replaced value="Replace in Opened Files: $INT_REPLACE$ occurrences were replaced"/>
<find-status-mark-re-malformed value="Mark: The regular expression to search is malformed"/>
<find-status-invalid-re value="Find: Invalid regular expression"/>
<find-status-mark-1-match value="1 match"/>
<find-status-mark-nb-matches value="$INT_REPLACE$ matches"/>
<find-status-count-re-malformed value="Count: The regular expression to search is malformed"/>
<find-status-count-1-match value="Count: 1 match"/>
<find-status-count-nb-matches value="Count: $INT_REPLACE$ matches"/>
<find-status-replaceall-re-malformed value="Replace All: The regular expression is malformed"/>
<find-status-replaceall-1-replaced value="Replace All: 1 occurrence was replaced"/>
<find-status-replaceall-nb-replaced value="Replace All: $INT_REPLACE$ occurrences were replaced"/>
<ind-status-replaceall-readonly value="Replace All: Cannot replace text. The current document is read only"/>
<find-status-replace-end-reached value="Replace: Replaced the 1st occurrence from the top. The end of document has been reached"/>
<find-status-replace-top-reached value="Replace: Replaced the 1st occurrence from the bottom. The begin of document has been reached"/>
<find-status-relaced-next-found value="Replace: 1 occurrence was replaced. The next occurence found"/>
<find-status-relaced-next-not-found value="Replace: 1 occurrence was replaced. The next occurence not found"/>
<find-status-replace-not-found value="Replace: no occurrence was found"/>
<find-status-replace-readonly value="Replace: Cannot replace text. The current document is read only"/>
<find-status-cannot-find value="Find: Can't find the text &quot;$STR_REPLACE$&quot;"/>
<find-status-mark-re-malformed value="Mark: The regular expression to search is malformed"/>
<find-status-mark-nb-matches value="$INT_REPLACE$ matches"/>
</MiscStrings>
</Native-Langue>
</NotepadPlus>

View File

@ -1113,13 +1113,25 @@ bool Notepad_plus::replaceInOpenedFiles() {
if (nbTotal < 0)
_findReplaceDlg.setStatusbarMessage(TEXT("Replace in Opened Files: The regular expression to search is formed badly"), FSNotFound);
{
generic_string msg = _nativeLangSpeaker.getLocalizedStrFromID("find-status-replaceinfiles-re-malformed", TEXT("Replace in Opened Files: The regular expression is malformed."));
_findReplaceDlg.setStatusbarMessage(msg, FSNotFound);
}
else
{
if (nbTotal)
enableCommand(IDM_FILE_SAVEALL, true, MENU | TOOLBAR);
TCHAR result[64];
wsprintf(result, TEXT("Replace in Opened Files: %s occurrences replaced."), commafyInt(nbTotal).c_str());
generic_string result;
if (nbTotal == 1)
{
result = _nativeLangSpeaker.getLocalizedStrFromID("find-status-replaceinopenedfiles-1-replaced", TEXT("Replace in Opened Files: 1 occurrence was replaced."));
}
else
{
result = _nativeLangSpeaker.getLocalizedStrFromID("find-status-replaceinopenedfiles-nb-replaced", TEXT("Replace in Opened Files: $INT_REPLACE$ occurrences were replaced."));
result = stringReplace(result, TEXT("$INT_REPLACE$"), std::to_wstring(nbTotal));
}
_findReplaceDlg.setStatusbarMessage(result, FSMessage);
}
return true;
@ -1549,9 +1561,17 @@ bool Notepad_plus::replaceInFiles()
_invisibleEditView.setCurrentBuffer(oldBuf);
_pEditView = pOldView;
TCHAR msg[128];
wsprintf(msg, TEXT("Replace in Files: %s occurrences replaced"), commafyInt(nbTotal).c_str());
_findReplaceDlg.setStatusbarMessage(msg, FSMessage);
generic_string result;
if (nbTotal == 1)
{
result = _nativeLangSpeaker.getLocalizedStrFromID("find-status-replaceinfiles-1-replaced", TEXT("Replace in Files: 1 occurrence was replaced."));
}
else
{
result = _nativeLangSpeaker.getLocalizedStrFromID("find-status-replaceinfiles-nb-replaced", TEXT("Replace in Files: $INT_REPLACE$ occurrences were replaced."));
result = stringReplace(result, TEXT("$INT_REPLACE$"), std::to_wstring(nbTotal));
}
_findReplaceDlg.setStatusbarMessage(result, FSMessage);
return true;
}

View File

@ -1014,10 +1014,15 @@ void Notepad_plus::command(int id)
FindStatus status = FSNoMessage;
_findReplaceDlg.processFindNext(s.c_str(), &op, &status);
if (status == FSEndReached)
_findReplaceDlg.setStatusbarMessage(TEXT("Find: Found the 1st occurrence from the top. The end of document has been reached."), FSEndReached);
{
generic_string msg = _nativeLangSpeaker.getLocalizedStrFromID("find-status-find-from-top-end-reached", TEXT("Find: Found the 1st occurrence from the top. The end of document has been reached."));
_findReplaceDlg.setStatusbarMessage(msg, FSEndReached);
}
else if (status == FSTopReached)
_findReplaceDlg.setStatusbarMessage(TEXT("Find: Found the 1st occurrence from the bottom. The begin of document has been reached."), FSTopReached);
break;
{
generic_string msg = _nativeLangSpeaker.getLocalizedStrFromID("find-status-find-from-bottom-begin-reached", TEXT("Find: Found the 1st occurrence from the bottom. The begin of document has been reached."));
_findReplaceDlg.setStatusbarMessage(msg, FSTopReached);
}
}
break;
@ -1043,22 +1048,30 @@ void Notepad_plus::command(int id)
FindStatus status = FSNoMessage;
_findReplaceDlg.processFindNext(str, &op, &status);
if (status == FSEndReached)
_findReplaceDlg.setStatusbarMessage(TEXT("Find: Found the 1st occurrence from the top. The end of document has been reached."), FSEndReached);
{
generic_string msg = _nativeLangSpeaker.getLocalizedStrFromID("find-status-find-from-top-end-reached", TEXT("Find: Found the 1st occurrence from the top. The end of document has been reached."));
_findReplaceDlg.setStatusbarMessage(msg, FSEndReached);
}
else if (status == FSTopReached)
_findReplaceDlg.setStatusbarMessage(TEXT("Find: Found the 1st occurrence from the bottom. The begin of document has been reached."), FSTopReached);
break;
{
generic_string msg = _nativeLangSpeaker.getLocalizedStrFromID("find-status-find-from-bottom-begin-reached", TEXT("Find: Found the 1st occurrence from the bottom. The begin of document has been reached."));
_findReplaceDlg.setStatusbarMessage(msg, FSTopReached);
}
}
break;
case IDM_SEARCH_GOTONEXTFOUND:
{
_findReplaceDlg.gotoNextFoundResult();
break;
}
break;
case IDM_SEARCH_GOTOPREVFOUND:
{
_findReplaceDlg.gotoNextFoundResult(-1);
break;
}
break;
case IDM_FOCUS_ON_FOUND_RESULTS:
{
if (GetFocus() == _findReplaceDlg.getHFindResults())
@ -1066,8 +1079,8 @@ void Notepad_plus::command(int id)
switchEditViewTo(currentView());
else
_findReplaceDlg.focusOnFinder();
break;
}
break;
case IDM_SEARCH_VOLATILE_FINDNEXT :
case IDM_SEARCH_VOLATILE_FINDPREV :
@ -1082,12 +1095,17 @@ void Notepad_plus::command(int id)
FindStatus status = FSNoMessage;
_findReplaceDlg.processFindNext(text2Find, &op, &status);
if (status == FSEndReached)
_findReplaceDlg.setStatusbarMessage(TEXT("Find: Found the 1st occurrence from the top. The end of document has been reached."), FSEndReached);
{
generic_string msg = _nativeLangSpeaker.getLocalizedStrFromID("find-status-find-from-top-end-reached", TEXT("Find: Found the 1st occurrence from the top. The end of document has been reached."));
_findReplaceDlg.setStatusbarMessage(msg, FSEndReached);
}
else if (status == FSTopReached)
_findReplaceDlg.setStatusbarMessage(TEXT("Find: Found the 1st occurrence from the bottom. The begin of document has been reached."), FSTopReached);
break;
{
generic_string msg = _nativeLangSpeaker.getLocalizedStrFromID("find-status-find-from-bottom-begin-reached", TEXT("Find: Found the 1st occurrence from the bottom. The begin of document has been reached."));
_findReplaceDlg.setStatusbarMessage(msg, FSTopReached);
}
}
break;
case IDM_SEARCH_MARKALLEXT1 :
case IDM_SEARCH_MARKALLEXT2 :
@ -1122,8 +1140,9 @@ void Notepad_plus::command(int id)
{
_findReplaceDlg.markAll(text2Find, styleID, lstrlen(text2Find) == lstrlen(text2Find2));
}
break;
}
break;
case IDM_SEARCH_UNMARKALLEXT1 :
case IDM_SEARCH_UNMARKALLEXT2 :
case IDM_SEARCH_UNMARKALLEXT3 :
@ -1143,8 +1162,8 @@ void Notepad_plus::command(int id)
styleID = SCE_UNIVERSAL_FOUND_STYLE_EXT5;
_pEditView->clearIndicator(styleID);
break;
}
break;
case IDM_SEARCH_GONEXTMARKER1 :
case IDM_SEARCH_GONEXTMARKER2 :
@ -1168,9 +1187,8 @@ void Notepad_plus::command(int id)
styleID = SCE_UNIVERSAL_FOUND_STYLE;
goToNextIndicator(styleID);
break;
}
break;
case IDM_SEARCH_GOPREVMARKER1 :
case IDM_SEARCH_GOPREVMARKER2 :
@ -1193,10 +1211,9 @@ void Notepad_plus::command(int id)
else // (id == IDM_SEARCH_GOPREVMARKER_DEF)
styleID = SCE_UNIVERSAL_FOUND_STYLE;
goToPreviousIndicator(styleID);
break;
goToPreviousIndicator(styleID);
}
break;
case IDM_SEARCH_CLEARALLMARKS :
{
@ -1205,8 +1222,8 @@ void Notepad_plus::command(int id)
_pEditView->clearIndicator(SCE_UNIVERSAL_FOUND_STYLE_EXT3);
_pEditView->clearIndicator(SCE_UNIVERSAL_FOUND_STYLE_EXT4);
_pEditView->clearIndicator(SCE_UNIVERSAL_FOUND_STYLE_EXT5);
break;
}
break;
case IDM_SEARCH_GOTOLINE :
{
@ -1214,8 +1231,8 @@ void Notepad_plus::command(int id)
_goToLineDlg.doDialog(_nativeLangSpeaker.isRTL());
if (isFirstTime)
_nativeLangSpeaker.changeDlgLang(_goToLineDlg.getHSelf(), "GoToLine");
break;
}
break;
case IDM_SEARCH_FINDCHARINRANGE :
{
@ -1223,8 +1240,8 @@ void Notepad_plus::command(int id)
_findCharsInRangeDlg.doDialog(_nativeLangSpeaker.isRTL());
if (isFirstTime)
_nativeLangSpeaker.changeDlgLang(_findCharsInRangeDlg.getHSelf(), "FindCharsInRange");
break;
}
break;
case IDM_EDIT_COLUMNMODETIP :
{
@ -1233,8 +1250,8 @@ void Notepad_plus::command(int id)
TEXT("Please use \"ALT+Mouse Selection\" or \"Alt+Shift+Arrow key\" to switch to column mode."),
TEXT("Column Mode Tip"),
MB_OK|MB_APPLMODAL);
break;
}
break;
case IDM_EDIT_COLUMNMODE :
{
@ -1242,8 +1259,8 @@ void Notepad_plus::command(int id)
_colEditorDlg.doDialog(_nativeLangSpeaker.isRTL());
if (isFirstTime)
_nativeLangSpeaker.changeDlgLang(_colEditorDlg.getHSelf(), "ColumnEditor");
break;
}
break;
case IDM_SEARCH_GOTOMATCHINGBRACE :
case IDM_SEARCH_SELECTMATCHINGBRACES :
@ -1259,8 +1276,8 @@ void Notepad_plus::command(int id)
else
_pEditView->execute(SCI_SETSEL, min(braceAtCaret, braceOpposite), max(braceAtCaret, braceOpposite) + 1); // + 1 so we always include the ending brace in the selection.
}
break;
}
break;
case IDM_SEARCH_TOGGLE_BOOKMARK :
bookmarkToggle(-1);
@ -1345,9 +1362,8 @@ void Notepad_plus::command(int id)
}
checkMenuItem(IDM_LANG_USER_DLG, !isUDDlgVisible);
_toolBar.setCheck(IDM_LANG_USER_DLG, !isUDDlgVisible);
break;
}
break;
case IDM_EDIT_SELECTALL:
_pEditView->execute(SCI_SELECTALL);

View File

@ -801,9 +801,7 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
_findClosePos.top = p.y + 10;
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
generic_string searchButtonTip = pNativeSpeaker->getLocalizedStrFromID("shift-change-direction-tip");
if (searchButtonTip.empty())
searchButtonTip = TEXT("Use Shift+Enter to search in the opposite direction.");
generic_string searchButtonTip = pNativeSpeaker->getLocalizedStrFromID("shift-change-direction-tip", TEXT("Use Shift+Enter to search in the opposite direction."));
_shiftTrickUpTip = CreateToolTip(IDOK, _hSelf, _hInst, const_cast<PTSTR>(searchButtonTip.c_str()));
@ -815,9 +813,7 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
SendMessage(_shiftTrickUpTip, TTM_SETDELAYTIME, TTDT_AUTOPOP, MAKELPARAM((15000), (0)));
}
generic_string checkboxTip = pNativeSpeaker->getLocalizedStrFromID("two-find-buttons-tip");
if (checkboxTip.empty())
checkboxTip = TEXT("2 find buttons mode");
generic_string checkboxTip = pNativeSpeaker->getLocalizedStrFromID("two-find-buttons-tip", TEXT("2 find buttons mode"));
_2ButtonsTip = CreateToolTip(IDC_2_BUTTONS_MODE, _hSelf, _hInst, const_cast<PTSTR>(checkboxTip.c_str()));
@ -1002,10 +998,17 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
// restore search direction which may have been overwritten because shift-key was pressed
_options._whichDirection = direction_bak;
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
if (findStatus == FSEndReached)
setStatusbarMessage(TEXT("Find: Found the 1st occurrence from the top. The end of the document has been reached."), FSEndReached);
{
generic_string msg = pNativeSpeaker->getLocalizedStrFromID("find-status-end-reached", TEXT("Find: Found the 1st occurrence from the top. The end of the document has been reached."));
setStatusbarMessage(msg, FSEndReached);
}
else if (findStatus == FSTopReached)
setStatusbarMessage(TEXT("Find: Found the 1st occurrence from the bottom. The beginning of the document has been reached."), FSTopReached);
{
generic_string msg = pNativeSpeaker->getLocalizedStrFromID("find-status-top-reached", TEXT("Find: Found the 1st occurrence from the bottom. The beginning of the document has been reached."));
setStatusbarMessage(msg, FSTopReached);
}
nppParamInst->_isFindReplacing = false;
}
@ -1166,8 +1169,9 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
setStatusbarMessage(TEXT(""), FSNoMessage);
if ((*_ppEditView)->getCurrentBuffer()->isReadOnly())
{
generic_string errMsg = TEXT("Replace: Cannot replace text. The current document is read only.");
setStatusbarMessage(errMsg, FSNotFound);
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
generic_string msg = pNativeSpeaker->getLocalizedStrFromID("find-status-replace-readonly", TEXT("Replace: Cannot replace text. The current document is read only."));
setStatusbarMessage(msg, FSNotFound);
return TRUE;
}
@ -1184,21 +1188,25 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
(*_ppEditView)->execute(SCI_ENDUNDOACTION);
nppParamInst->_isFindReplacing = false;
generic_string result = TEXT("");
generic_string result;
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
if (nbReplaced < 0)
result = TEXT("Replace All: The regular expression is malformed.");
{
result = pNativeSpeaker->getLocalizedStrFromID("find-status-replaceall-re-malformed", TEXT("Replace All: The regular expression is malformed."));
}
else
{
TCHAR moreInfo[64];
if(nbReplaced == 1)
wsprintf(moreInfo, TEXT("Replace All: %d occurrence was replaced."), nbReplaced);
if (nbReplaced == 1)
{
result = pNativeSpeaker->getLocalizedStrFromID("find-status-replaceall-1-replaced", TEXT("Replace All: 1 occurrence was replaced."));
}
else
wsprintf(moreInfo, TEXT("Replace All: %s occurrences were replaced."), commafyInt(nbReplaced).c_str());
result = moreInfo;
{
result = pNativeSpeaker->getLocalizedStrFromID("find-status-replaceall-nb-replaced", TEXT("Replace All: $INT_REPLACE$ occurrences were replaced."));
result = stringReplace(result, TEXT("$INT_REPLACE$"), std::to_wstring(nbReplaced));
}
}
setStatusbarMessage(result, FSMessage);
//::SetFocus(_hSelf);
getFocus();
}
}
@ -1214,22 +1222,28 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
_options._str2Search = getTextFromCombo(hFindCombo);
int nbCounted = processAll(ProcessCountAll, &_options);
generic_string result = TEXT("");
generic_string result;
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
if (nbCounted < 0)
result = TEXT("Count: The regular expression to search is malformed.");
{
result = pNativeSpeaker->getLocalizedStrFromID("find-status-count-re-malformed", TEXT("Count: The regular expression to search is malformed."));
}
else
{
TCHAR moreInfo[128];
if (nbCounted == 1)
wsprintf(moreInfo, TEXT("Count: %d match."), nbCounted);
{
result = pNativeSpeaker->getLocalizedStrFromID("find-status-count-1-match", TEXT("Count: 1 match."));
}
else
wsprintf(moreInfo, TEXT("Count: %s matches."), commafyInt(nbCounted).c_str());
result = moreInfo;
{
result = pNativeSpeaker->getLocalizedStrFromID("find-status-count-nb-matches", TEXT("Count: $INT_REPLACE$ matches."));
result = stringReplace(result, TEXT("$INT_REPLACE$"), std::to_wstring(nbCounted));
}
}
if (isMacroRecording) saveInMacro(wParam, FR_OP_FIND);
setStatusbarMessage(result, FSMessage);
//::SetFocus(_hSelf);
getFocus();
}
}
@ -1248,20 +1262,26 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
nppParamInst->_isFindReplacing = true;
int nbMarked = processAll(ProcessMarkAll, &_options);
nppParamInst->_isFindReplacing = false;
generic_string result = TEXT("");
generic_string result;
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
if (nbMarked < 0)
result = TEXT("Mark: The regular expression to search is malformed.");
{
result = pNativeSpeaker->getLocalizedStrFromID("find-status-mark-re-malformed", TEXT("Mark: The regular expression to search is malformed."));
}
else
{
TCHAR moreInfo[128];
if(nbMarked == 1)
wsprintf(moreInfo, TEXT("Mark: %d match."), nbMarked);
if (nbMarked == 1)
{
result = pNativeSpeaker->getLocalizedStrFromID("find-status-mark-1-match", TEXT("1 match."));
}
else
wsprintf(moreInfo, TEXT("Mark: %s matches."), commafyInt(nbMarked).c_str());
result = moreInfo;
{
result = pNativeSpeaker->getLocalizedStrFromID("find-status-mark-nb-matches", TEXT("$INT_REPLACE$ matches."));
result = stringReplace(result, TEXT("$INT_REPLACE$"), std::to_wstring(nbMarked));
}
}
setStatusbarMessage(result, FSMessage);
//::SetFocus(_hSelf);
getFocus();
}
}
@ -1578,15 +1598,15 @@ bool FindReplaceDlg::processFindNext(const TCHAR *txt2find, const FindOption *op
//failed, or failed twice with wrap
if (NotIncremental == pOptions->_incrementalType) //incremental search doesnt trigger messages
{
generic_string msg = TEXT("Find: Can't find the text \"");
msg += stringReplace(txt2find, TEXT("&"), TEXT("&&"));
msg += TEXT("\"");
generic_string newTxt2find = stringReplace(txt2find, TEXT("&"), TEXT("&&"));
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
generic_string msg = pNativeSpeaker->getLocalizedStrFromID("find-status-cannot-find", TEXT("Find: Can't find the text \"$STR_REPLACE$\""));
msg = stringReplace(msg, TEXT("$STR_REPLACE$"), newTxt2find);
setStatusbarMessage(msg, FSNotFound);
// if the dialog is not shown, pass the focus to his parent(ie. Notepad++)
if (!::IsWindowVisible(_hSelf))
{
//::SetFocus((*_ppEditView)->getHSelf());
(*_ppEditView)->getFocus();
}
else
@ -1600,7 +1620,9 @@ bool FindReplaceDlg::processFindNext(const TCHAR *txt2find, const FindOption *op
}
else if (posFind == -2) // Invalid Regular expression
{
setStatusbarMessage(TEXT("Find: Invalid regular expression"), FSNotFound);
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
generic_string msg = pNativeSpeaker->getLocalizedStrFromID("find-status-invalid-re", TEXT("Find: Invalid regular expression"));
setStatusbarMessage(msg, FSNotFound);
return false;
}
@ -1641,8 +1663,9 @@ bool FindReplaceDlg::processReplace(const TCHAR *txt2find, const TCHAR *txt2repl
if ((*_ppEditView)->getCurrentBuffer()->isReadOnly())
{
generic_string errMsg = TEXT("Replace: Cannot replace text. The current document is read only.");
setStatusbarMessage(errMsg, FSNotFound);
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
generic_string msg = pNativeSpeaker->getLocalizedStrFromID("find-status-replace-readonly", TEXT("Replace: Cannot replace text. The current document is read only."));
setStatusbarMessage(msg, FSNotFound);
return false;
}
@ -1686,29 +1709,38 @@ bool FindReplaceDlg::processReplace(const TCHAR *txt2find, const TCHAR *txt2repl
}
}
(*_ppEditView)->execute(SCI_SETSEL, start + replacedLen, start + replacedLen);
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
// Do the next find
moreMatches = processFindNext(txt2find, &replaceOptions, &status, FINDNEXTTYPE_REPLACENEXT);
if (status == FSEndReached)
{
setStatusbarMessage(TEXT("Replace: Replaced the 1st occurrence from the top. The end of document has been reached."), FSEndReached);
generic_string msg = pNativeSpeaker->getLocalizedStrFromID("find-status-replace-end-reached", TEXT("Replace: Replaced the 1st occurrence from the top. The end of document has been reached."));
setStatusbarMessage(msg, FSEndReached);
}
else if (status == FSTopReached)
{
setStatusbarMessage(TEXT("Replace: Replaced the 1st occurrence from the bottom. The begin of document has been reached."), FSTopReached);
generic_string msg = pNativeSpeaker->getLocalizedStrFromID("find-status-replace-top-reached", TEXT("Replace: Replaced the 1st occurrence from the bottom. The begin of document has been reached."));
setStatusbarMessage(msg, FSTopReached);
}
else
{
generic_string msg = TEXT("Replace: 1 occurrence was replaced. ");
msg += moreMatches?TEXT("The next occurence found"):TEXT("The next occurence not found");
generic_string msg;
if (moreMatches)
msg = pNativeSpeaker->getLocalizedStrFromID("find-status-replaced-next-found", TEXT("Replace: 1 occurrence was replaced. The next occurence found"));
else
msg = pNativeSpeaker->getLocalizedStrFromID("find-status-replaced-next-not-found", TEXT("Replace: 1 occurrence was replaced. The next occurence not found"));
setStatusbarMessage(msg, FSMessage);
}
}
}
else
{
setStatusbarMessage(TEXT("Replace: no occurrence was found."), FSNotFound);
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
generic_string msg = pNativeSpeaker->getLocalizedStrFromID("find-status-replace-not-found", TEXT("Replace: no occurrence was found."));
setStatusbarMessage(msg, FSNotFound);
}
return moreMatches;
@ -1740,8 +1772,9 @@ int FindReplaceDlg::processAll(ProcessOperation op, const FindOption *opt, bool
{
if (op == ProcessReplaceAll && (*_ppEditView)->getCurrentBuffer()->isReadOnly())
{
generic_string result = TEXT("Replace All: Cannot replace text. The current document is read only.");
setStatusbarMessage(result, FSNotFound);
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
generic_string msg = pNativeSpeaker->getLocalizedStrFromID("find-status-replaceall-readonly", TEXT("Replace All: Cannot replace text. The current document is read only."));
setStatusbarMessage(msg, FSNotFound);
return 0;
}
@ -2585,41 +2618,53 @@ void FindReplaceDlg::execSavedCommand(int cmd, uptr_t intValue, generic_string s
nppParamInst->_isFindReplacing = false;
generic_string result;
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
if (nbReplaced < 0)
result = TEXT("Replace All: The regular expression is malformed.");
{
result = pNativeSpeaker->getLocalizedStrFromID("find-status-replaceall-re-malformed", TEXT("Replace All: The regular expression is malformed."));
}
else
{
TCHAR moreInfo[64];
if (nbReplaced == 1)
wsprintf(moreInfo, TEXT("Replace All: %d occurrence was replaced."), nbReplaced);
{
result = pNativeSpeaker->getLocalizedStrFromID("find-status-replaceall-1-replaced", TEXT("Replace All: 1 occurrence was replaced."));
}
else
wsprintf(moreInfo, TEXT("Replace All: %s occurrences were replaced."), commafyInt(nbReplaced).c_str());
result = moreInfo;
{
result = pNativeSpeaker->getLocalizedStrFromID("find-status-replaceall-nb-replaced", TEXT("Replace All: $INT_REPLACE$ occurrences were replaced."));
result = stringReplace(result, TEXT("$INT_REPLACE$"), std::to_wstring(nbReplaced));
}
}
setStatusbarMessage(result, FSMessage);
break;
}
case IDCCOUNTALL :
{
int nbCounted = processAll(ProcessCountAll, _env);
generic_string result;
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
if (nbCounted < 0)
result = TEXT("Count: The regular expression to search is malformed.");
{
result = pNativeSpeaker->getLocalizedStrFromID("find-status-count-re-malformed", TEXT("Count: The regular expression to search is malformed."));
}
else
{
TCHAR moreInfo[128];
if (nbCounted == 1)
wsprintf(moreInfo, TEXT("Count: %d match."), nbCounted);
{
result = pNativeSpeaker->getLocalizedStrFromID("find-status-count-1-match", TEXT("Count: 1 match."));
}
else
wsprintf(moreInfo, TEXT("Count: %s matches."), commafyInt(nbCounted).c_str());
result = moreInfo;
{
result = pNativeSpeaker->getLocalizedStrFromID("find-status-count-nb-matches", TEXT("Count: $INT_REPLACE$ matches."));
result = stringReplace(result, TEXT("$INT_REPLACE$"), std::to_wstring(nbCounted));
}
}
setStatusbarMessage(result, FSMessage);
break;
}
case IDCMARKALL:
{
nppParamInst->_isFindReplacing = true;
@ -2627,17 +2672,25 @@ void FindReplaceDlg::execSavedCommand(int cmd, uptr_t intValue, generic_string s
nppParamInst->_isFindReplacing = false;
generic_string result;
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
if (nbMarked < 0)
{
result = TEXT("Mark: The regular expression to search is malformed.");
result = pNativeSpeaker->getLocalizedStrFromID("find-status-mark-re-malformed", TEXT("Mark: The regular expression to search is malformed."));
}
else
{
TCHAR moreInfo[128];
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
generic_string msg = pNativeSpeaker->getLocalizedStrFromID("find-status-invalid-re", TEXT("Find: Invalid regular expression"));
if (nbMarked <= 1)
wsprintf(moreInfo, TEXT("%d match."), nbMarked);
{
result = pNativeSpeaker->getLocalizedStrFromID("find-status-mark-1-match", TEXT("1 match."));
}
else
wsprintf(moreInfo, TEXT("%s matches."), commafyInt(nbMarked).c_str());
{
result = pNativeSpeaker->getLocalizedStrFromID("find-status-mark-nb-matches", TEXT("$INT_REPLACE$ matches."));
result = stringReplace(result, TEXT("$INT_REPLACE$"), std::to_wstring(nbMarked));
}
result = moreInfo;
}

View File

@ -134,7 +134,10 @@ void ShortcutMapper::initBabyGrid() {
_babygrid.setHighlightColorProtect(RGB(244,10,20));
_babygrid.setHighlightColorProtectNoFocus(RGB(230,194,190));
NppParameters::getInstance()->getNativeLangSpeaker()->changeDlgLang(_hSelf, "ShortcutMapper");
NativeLangSpeaker* nativeLangSpeaker = NppParameters::getInstance()->getNativeLangSpeaker();
nativeLangSpeaker->changeDlgLang(_hSelf, "ShortcutMapper");
_conflictInfoOk = nativeLangSpeaker->getShortcutMapperLangStr("ConflictInfoOk", TEXT("No shortcut conflicts for this item."));
_conflictInfoEditing = nativeLangSpeaker->getShortcutMapperLangStr("ConflictInfoEditing", TEXT("No conflicts . . ."));
}
generic_string ShortcutMapper::getTextFromCombo(HWND hCombo)
@ -537,7 +540,7 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
if (isConflict)
::SendDlgItemMessage(_hSelf, IDC_BABYGRID_INFO, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(conflictInfo.c_str()));
else
::SendDlgItemMessage(_hSelf, IDC_BABYGRID_INFO, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(_assignInfo.c_str()));
::SendDlgItemMessage(_hSelf, IDC_BABYGRID_INFO, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(_conflictInfoEditing.c_str()));
return TRUE;
}
@ -1079,7 +1082,7 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
}
if (conflictInfo.empty())
::SendDlgItemMessage(_hSelf, IDC_BABYGRID_INFO, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(_defaultInfo.c_str()));
::SendDlgItemMessage(_hSelf, IDC_BABYGRID_INFO, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(_conflictInfoOk.c_str()));
else
::SendDlgItemMessage(_hSelf, IDC_BABYGRID_INFO, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(conflictInfo.c_str()));

View File

@ -87,8 +87,8 @@ private:
std::vector<size_t> _lastHomeRow;
std::vector<size_t> _lastCursorRow;
const generic_string _defaultInfo = TEXT("No shortcut conflicts for this item.");
const generic_string _assignInfo = TEXT("No conflicts . . .");
generic_string _conflictInfoOk;
generic_string _conflictInfoEditing;
std::vector<HFONT> _hGridFonts;

View File

@ -45,7 +45,7 @@ BEGIN
DEFPUSHBUTTON "Clear",IDM_BABYGRID_CLEAR,172,330,47,14
DEFPUSHBUTTON "Delete",IDM_BABYGRID_DELETE,226,330,47,14
DEFPUSHBUTTON "Close",IDOK,280,330,47,14
EDITTEXT IDC_BABYGRID_INFO,4,279,440,29,ES_MULTILINE | ES_AUTOHSCROLL | ES_READONLY | WS_VSCROLL | NOT WS_TABSTOP
RTEXT "Filter :",IDC_BABYGRID_STATIC,4,310,25,12
EDITTEXT IDC_BABYGRID_FILTER,30,310,415,12,ES_AUTOHSCROLL | ES_WANTRETURN | NOT WS_BORDER,WS_EX_STATICEDGE
EDITTEXT IDC_BABYGRID_INFO,4,281,440,29,ES_MULTILINE | ES_AUTOHSCROLL | ES_READONLY | WS_VSCROLL | NOT WS_TABSTOP
RTEXT "Filter :",IDC_BABYGRID_STATIC,4,313,25,12
EDITTEXT IDC_BABYGRID_FILTER,30,312,415,12,ES_AUTOHSCROLL | ES_WANTRETURN | NOT WS_BORDER,WS_EX_STATICEDGE
END

View File

@ -2946,11 +2946,12 @@ generic_string DelimiterSettingsDlg::getWarningText(size_t nbSp, size_t nbTab) c
{
generic_string nbSpStr = std::to_wstring(nbSp);
generic_string nbTabStr = std::to_wstring(nbTab);
generic_string warnBegin = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-warning-begin");
generic_string space = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-space-warning");
generic_string tab = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-tab-warning");
generic_string warnEnd = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-warning-end");
generic_string warnBegin = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-warning-begin", TEXT(""));
generic_string space = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-space-warning", TEXT(""));
generic_string tab = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-tab-warning", TEXT(""));
generic_string warnEnd = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-warning-end", TEXT(""));
// half translation is not allowed
if (not warnBegin.empty() && not space.empty() && not tab.empty() && not warnEnd.empty())
{
space = stringReplace(space, TEXT("$INT_REPLACE$"), nbSpStr);
@ -2973,9 +2974,11 @@ generic_string DelimiterSettingsDlg::getWarningText(size_t nbSp, size_t nbTab) c
else if (nbSp && not nbTab)
{
generic_string nbSpStr = std::to_wstring(nbSp);
generic_string warnBegin = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-warning-begin");
generic_string space = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-space-warning");
generic_string warnEnd = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-warning-end");
generic_string warnBegin = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-warning-begin", TEXT(""));
generic_string space = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-space-warning", TEXT(""));
generic_string warnEnd = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-warning-end", TEXT(""));
// half translation is not allowed
if (not warnBegin.empty() && not space.empty() && not warnEnd.empty())
{
space = stringReplace(space, TEXT("$INT_REPLACE$"), nbSpStr);
@ -2993,9 +2996,11 @@ generic_string DelimiterSettingsDlg::getWarningText(size_t nbSp, size_t nbTab) c
else if (not nbSp && nbTab)
{
generic_string nbTabStr = std::to_wstring(nbTab);
generic_string warnBegin = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-warning-begin");
generic_string tab = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-tab-warning");
generic_string warnEnd = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-warning-end");
generic_string warnBegin = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-warning-begin", TEXT(""));
generic_string tab = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-tab-warning", TEXT(""));
generic_string warnEnd = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-warning-end", TEXT(""));
// half translation is not allowed
if (not warnBegin.empty() && not tab.empty() && not warnEnd.empty())
{
tab = stringReplace(tab, TEXT("$INT_REPLACE$"), nbTabStr);
@ -3091,9 +3096,7 @@ INT_PTR CALLBACK DelimiterSettingsDlg::run_dlgProc(UINT message, WPARAM wParam,
setWarningIfNeed();
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
generic_string tip2show = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-tip");
if (tip2show.empty())
tip2show = TEXT("This allows you to include additional character into current word characters while double clicking for selection or searching with \"Match whole word only\" option checked.");
generic_string tip2show = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-tip", TEXT("This allows you to include additional character into current word characters while double clicking for selection or searching with \"Match whole word only\" option checked."));
_tip = CreateToolTip(IDD_WORDCHAR_QUESTION_BUTTON, _hSelf, _hInst, const_cast<PTSTR>(tip2show.c_str()));
if (_tip)
@ -3231,9 +3234,7 @@ INT_PTR CALLBACK SettingsOnCloudDlg::run_dlgProc(UINT message, WPARAM wParam, LP
generic_string message;
if (nppParams->isCloudPathChanged())
{
message = pNativeSpeaker->getLocalizedStrFromID("cloud-restart-warning");
if (message.empty())
message = TEXT("Please restart Notepad++ to take effect.");
message = pNativeSpeaker->getLocalizedStrFromID("cloud-restart-warning", TEXT("Please restart Notepad++ to take effect."));
}
::SetDlgItemText(_hSelf, IDC_SETTINGSONCLOUD_WARNING_STATIC, message.c_str());
}
@ -3242,9 +3243,8 @@ INT_PTR CALLBACK SettingsOnCloudDlg::run_dlgProc(UINT message, WPARAM wParam, LP
bool isChecked = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_WITHCLOUD_RADIO, BM_GETCHECK, 0, 0));
if (isChecked)
{
generic_string message = pNativeSpeaker->getLocalizedStrFromID("cloud-invalid-warning");
if (message.empty())
message = TEXT("Invalid path.");
generic_string message = pNativeSpeaker->getLocalizedStrFromID("cloud-invalid-warning", TEXT("Invalid path."));
::SetDlgItemText(_hSelf, IDC_SETTINGSONCLOUD_WARNING_STATIC, message.c_str());
nppParams->removeCloudChoice();
}
@ -3280,6 +3280,7 @@ INT_PTR CALLBACK SettingsOnCloudDlg::run_dlgProc(UINT message, WPARAM wParam, LP
case WM_COMMAND:
{
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
switch (wParam)
{
case IDC_NOCLOUD_RADIO:
@ -3288,13 +3289,11 @@ INT_PTR CALLBACK SettingsOnCloudDlg::run_dlgProc(UINT message, WPARAM wParam, LP
nppParams->removeCloudChoice();
generic_string message;
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
if (nppParams->isCloudPathChanged())
{
message = pNativeSpeaker->getLocalizedStrFromID("cloud-restart-warning");
if (message.empty())
message = TEXT("Please restart Notepad++ to take effect.");
message = pNativeSpeaker->getLocalizedStrFromID("cloud-restart-warning", TEXT("Please restart Notepad++ to take effect."));
}
// else set empty string
::SetDlgItemText(_hSelf, IDC_SETTINGSONCLOUD_WARNING_STATIC, message.c_str());
::SendDlgItemMessage(_hSelf, IDC_CLOUDPATH_EDIT, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(nppGUI._cloudPath.c_str()));
@ -3305,10 +3304,7 @@ INT_PTR CALLBACK SettingsOnCloudDlg::run_dlgProc(UINT message, WPARAM wParam, LP
case IDC_WITHCLOUD_RADIO:
{
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
generic_string message = pNativeSpeaker->getLocalizedStrFromID("cloud-invalid-warning");
if (message.empty())
message = TEXT("Invalid path.");
generic_string message = pNativeSpeaker->getLocalizedStrFromID("cloud-invalid-warning", TEXT("Invalid path."));
::SetDlgItemText(_hSelf, IDC_SETTINGSONCLOUD_WARNING_STATIC, message.c_str());
::EnableWindow(::GetDlgItem(_hSelf, IDC_CLOUDPATH_EDIT), true);
@ -3318,7 +3314,8 @@ INT_PTR CALLBACK SettingsOnCloudDlg::run_dlgProc(UINT message, WPARAM wParam, LP
case IDD_CLOUDPATH_BROWSE_BUTTON:
{
folderBrowser(_hSelf, TEXT("Select a folder from/to where Notepad++ reads/writes its settings"), IDC_CLOUDPATH_EDIT);
generic_string message = pNativeSpeaker->getLocalizedStrFromID("cloud-select-folder", TEXT("Select a folder from/to where Notepad++ reads/writes its settings"));
folderBrowser(_hSelf, message, IDC_CLOUDPATH_EDIT);
}
break;

View File

@ -207,24 +207,24 @@ generic_string NativeLangSpeaker::getNativeLangMenuString(int itemID) const
return TEXT("");
}
generic_string NativeLangSpeaker::getLocalizedStrFromID(const char *strID) const
generic_string NativeLangSpeaker::getLocalizedStrFromID(const char *strID, const generic_string& defaultString) const
{
if (not _nativeLangA)
return TEXT("");
return defaultString;
if (not strID)
return TEXT("");
return defaultString;
TiXmlNodeA *node = _nativeLangA->FirstChild("MiscStrings");
if (not node) return TEXT("");
if (not node) return defaultString;
node = node->FirstChild(strID);
if (not node) return TEXT("");
if (not node) return defaultString;
TiXmlElementA *element = node->ToElement();
const char *value = element->Attribute("value");
if (not value) return TEXT("");
if (not value) return defaultString;
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
return wmc->char2wchar(value, _nativeLangEncoding);

View File

@ -85,7 +85,7 @@ public:
generic_string getProjectPanelLangMenuStr(const char * nodeName, int cmdID, const TCHAR *defaultStr) const;
generic_string getFileBrowserLangMenuStr(int cmdID, const TCHAR *defaultStr) const;
generic_string getAttrNameStr(const TCHAR *defaultStr, const char *nodeL1Name, const char *nodeL2Name = NULL) const;
generic_string getLocalizedStrFromID(const char *strID) const;
generic_string getLocalizedStrFromID(const char *strID, const generic_string& defaultString) const;
int messageBox(const char *msgBoxTagName, HWND hWnd, const TCHAR *message, const TCHAR *title, int msgBoxType, int intInfo = 0, const TCHAR *strInfo = NULL);
private: