Skip to content

Commit

Permalink
Add more translations
Browse files Browse the repository at this point in the history
Find dialog status bar messages are translatable.
Add more shortcut mapper translation entries.
  • Loading branch information
donho committed Feb 14, 2018
1 parent 360d45d commit 213af53
Show file tree
Hide file tree
Showing 10 changed files with 264 additions and 141 deletions.
34 changes: 34 additions & 0 deletions PowerEditor/installer/nativeLang/english.xml
Expand Up @@ -452,6 +452,7 @@
<Item id="2602" name="Modify"/>
<Item id="2603" name="Delete"/>
<Item id="2606" name="Clear"/>
<Item id="2607" name="Filter: "/>

This comment has been minimized.

Copy link
@rddim

rddim Feb 14, 2018

Contributor

Could you add please little more width for this string? The first letter is cutted when translate it.

<Item id="1" name="Close"/>
<ColumnName name="Name"/>
<ColumnShortcut name="Shortcut"/>
Expand All @@ -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"/>
Expand Down Expand Up @@ -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>
32 changes: 26 additions & 6 deletions PowerEditor/src/Notepad_plus.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down
72 changes: 44 additions & 28 deletions PowerEditor/src/NppCommands.cpp
Expand Up @@ -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;

Expand All @@ -1043,31 +1048,39 @@ 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())
// focus already on found results, switch to current edit view
switchEditViewTo(currentView());
else
_findReplaceDlg.focusOnFinder();
break;
}
break;

case IDM_SEARCH_VOLATILE_FINDNEXT :
case IDM_SEARCH_VOLATILE_FINDPREV :
Expand All @@ -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 :
Expand Down Expand Up @@ -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 :
Expand All @@ -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 :
Expand All @@ -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 :
Expand All @@ -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 :
{
Expand All @@ -1205,26 +1222,26 @@ 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 :
{
bool isFirstTime = !_goToLineDlg.isCreated();
_goToLineDlg.doDialog(_nativeLangSpeaker.isRTL());
if (isFirstTime)
_nativeLangSpeaker.changeDlgLang(_goToLineDlg.getHSelf(), "GoToLine");
break;
}
break;

case IDM_SEARCH_FINDCHARINRANGE :
{
bool isFirstTime = !_findCharsInRangeDlg.isCreated();
_findCharsInRangeDlg.doDialog(_nativeLangSpeaker.isRTL());
if (isFirstTime)
_nativeLangSpeaker.changeDlgLang(_findCharsInRangeDlg.getHSelf(), "FindCharsInRange");
break;
}
break;

case IDM_EDIT_COLUMNMODETIP :
{
Expand All @@ -1233,17 +1250,17 @@ 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 :
{
bool isFirstTime = !_colEditorDlg.isCreated();
_colEditorDlg.doDialog(_nativeLangSpeaker.isRTL());
if (isFirstTime)
_nativeLangSpeaker.changeDlgLang(_colEditorDlg.getHSelf(), "ColumnEditor");
break;
}
break;

case IDM_SEARCH_GOTOMATCHINGBRACE :
case IDM_SEARCH_SELECTMATCHINGBRACES :
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

1 comment on commit 213af53

@schnurlos
Copy link
Contributor

@schnurlos schnurlos commented on 213af53 Feb 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double entry for "find-status-mark-re-malformed"

Please sign in to comment.