Make Incremental Search panel translatable

Fix also checkbox overlap in incremental search bar.

Fix #8955, fix #8574, close #10420
pull/10443/head
Don Ho 2021-08-21 12:35:00 +02:00
parent deab93f9b5
commit e12b161d48
7 changed files with 96 additions and 24 deletions

View File

@ -431,6 +431,12 @@ The comments are here for explanation, it's not necessary to translate them.
<Item id="1725" name="Copy Marked Text"/>
</Find>
<IncrementalFind title="">
<Item id="1681" name="Find"/>
<Item id="1685" name="Match case"/>
<Item id="1690" name="Highlight all"/>
</IncrementalFind>
<FindCharsInRange title="Find Characters in Range...">
<Item id="2" name="Close"/>
<Item id="2901" name="Non-ASCII Characters (128-255)"/>
@ -1472,6 +1478,10 @@ Find in all files except exe, obj &amp;&amp; log:
<tab-untitled-string value="new " />
<file-save-assign-type value="&amp;Append extension" />
<close-panel-tip value="Close" />
<IncrementalFind-FSFound value="$INT_REPLACE$ matches" />
<IncrementalFind-FSNotFound value="Phrase not found" />
<IncrementalFind-FSTopReached value="Reached top of page, continued from bottom" />
<IncrementalFind-FSEndReached value="Reached end of page, continued from top" />
</MiscStrings>
</Native-Langue>
</NotepadPlus>

View File

@ -427,7 +427,11 @@
<Item id="1721" name="▲"/>
<Item id="1723" name="▼ Suivant"/>
</Find>
<IncrementalFind title="">
<Item id="1681" name="Rechercher :"/>
<Item id="1685" name="Sensible à la casse"/>
<Item id="1690" name="Surligner tout"/>
</IncrementalFind>
<FindCharsInRange title="Rechercher des caractères dans une plage">
<Item id="2" name="Fermer"/>
<Item id="2901" name="Caractères non-ASCII (128-255)"/>
@ -1434,6 +1438,10 @@ Rechercher dans tous les fichiers sauf exe, obj &amp;&amp; log:
<find-regex-zero-length-match value="la chaîne vide trouvée" />
<session-save-folder-as-workspace value="&quot;Dossier en tant qu'espace de travail&quot; inclus" />
<tab-untitled-string value="nouveau " />
<IncrementalFind-FSFound value="$INT_REPLACE$ correspondances" />
<IncrementalFind-FSNotFound value="Expression introuvable" />
<IncrementalFind-FSTopReached value="Haut de page atteint, continuer en partant du bas" />
<IncrementalFind-FSEndReached value="Fin de page atteinte, continuer en partant du haut" />
</MiscStrings>
</Native-Langue>
</NotepadPlus>

View File

@ -426,7 +426,12 @@
<Item id="1723" name="▼ 找下一個"/>
<Item id="1725" name="複製標記文字"/>
</Find>
<FindCharsInRange title="以字元編號搜尋字元">
<IncrementalFind title="">
<Item id="1681" name="搜尋:"/>
<Item id="1685" name="區分大小寫"/>
<Item id="1690" name="醒目提示所有"/>
</IncrementalFind>
<FindCharsInRange title="以字元編號搜尋字元">
<Item id="2" name="關閉"/>
<Item id="2901" name="非 ASCII 字元128-255"/>
<Item id="2902" name="ASCII 字元0-127"/>
@ -1424,6 +1429,10 @@
<find-regex-zero-length-match value="零長度的字元相符" />
<session-save-folder-as-workspace value="包含「資料夾工作區」" />
<tab-untitled-string value="新文件 " />
<IncrementalFind-FSFound value="$INT_REPLACE$ 相符" />
<IncrementalFind-FSNotFound value="找不到相符字串" />
<IncrementalFind-FSTopReached value="到達頁面頂部,從底部繼續" />
<IncrementalFind-FSEndReached value="到達頁面末尾,從頂部繼續 " />
</MiscStrings>
</Native-Langue>
</NotepadPlus>

View File

@ -6498,6 +6498,11 @@ bool Notepad_plus::reloadLang()
_nativeLangSpeaker.changeDlgLang(_runMacroDlg.getHSelf(), "MultiMacro");
}
if (_incrementFindDlg.isCreated())
{
_nativeLangSpeaker.changeDlgLang(_incrementFindDlg.getHSelf(), "IncrementalFind");
}
if (_findCharsInRangeDlg.isCreated())
{
_nativeLangSpeaker.changeDlgLang(_findCharsInRangeDlg.getHSelf(), "FindCharsInRange");

View File

@ -1172,6 +1172,10 @@ void Notepad_plus::command(int id)
const int strSize = FINDREPLACE_MAXLENGTH;
TCHAR str[strSize];
bool isFirstTime = !_incrementFindDlg.isCreated();
if (isFirstTime)
_nativeLangSpeaker.changeDlgLang(_incrementFindDlg.getHSelf(), "IncrementalFind");
_pEditView->getGenericSelectedText(str, strSize, false);
if (0 != str[0]) // the selected text is not empty, then use it
_incrementFindDlg.setSearchText(str, _pEditView->getCurrentBuffer()->getUnicodeMode() != uni8Bit);

View File

@ -4717,20 +4717,55 @@ void FindIncrementDlg::markSelectedTextInc(bool enable, FindOption *opt)
void FindIncrementDlg::setFindStatus(FindStatus iStatus, int nbCounted)
{
static TCHAR findCount[128] = TEXT("");
static const TCHAR * const findStatus[] = { findCount, // FSFound
TEXT("Phrase not found"), //FSNotFound
TEXT("Reached top of page, continued from bottom"), // FSTopReached
TEXT("Reached end of page, continued from top")}; // FSEndReached
if (nbCounted <= 0)
findCount[0] = '\0';
else if (nbCounted == 1)
wsprintf(findCount, TEXT("%d match."), nbCounted);
else
wsprintf(findCount, TEXT("%s matches."), commafyInt(nbCounted).c_str());
generic_string statusStr2Display;
if (iStatus<0 || iStatus >= sizeof(findStatus)/sizeof(findStatus[0]))
return; // out of range
static const TCHAR* const strFSNotFound = TEXT("Phrase not found");
static const TCHAR* const strFSTopReached = TEXT("Reached top of page, continued from bottom");
static const TCHAR* const strFSEndReached = TEXT("Reached end of page, continued from top");
NativeLangSpeaker* pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
if (nbCounted >= 0)
{
statusStr2Display = pNativeSpeaker->getLocalizedStrFromID("IncrementalFind-FSFound", TEXT(""));
if (statusStr2Display.empty())
{
TCHAR strFindFSFound[128] = TEXT("");
if (nbCounted == 1)
wsprintf(strFindFSFound, TEXT("%d match"), nbCounted);
else
wsprintf(strFindFSFound, TEXT("%s matches"), commafyInt(nbCounted).c_str());
statusStr2Display = strFindFSFound;
}
else
{
statusStr2Display = stringReplace(statusStr2Display, TEXT("$INT_REPLACE$"), std::to_wstring(nbCounted));
}
}
switch (iStatus)
{
case FindStatus::FSNotFound:
statusStr2Display = pNativeSpeaker->getLocalizedStrFromID("IncrementalFind-FSNotFound", strFSNotFound);
break;
case FindStatus::FSTopReached:
statusStr2Display = pNativeSpeaker->getLocalizedStrFromID("IncrementalFind-FSTopReached", strFSTopReached);
break;
case FindStatus::FSEndReached:
statusStr2Display = pNativeSpeaker->getLocalizedStrFromID("IncrementalFind-FSEndReached", strFSEndReached);
break;
case FindStatus::FSFound:
break;
default:
return; // out of range
}
_findStatus = iStatus;
@ -4739,7 +4774,8 @@ void FindIncrementDlg::setFindStatus(FindStatus iStatus, int nbCounted)
// invalidate the editor rect
::InvalidateRect(hEditor, NULL, TRUE);
::SendDlgItemMessage(_hSelf, IDC_INCFINDSTATUS, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(findStatus[iStatus]));
::SendDlgItemMessage(_hSelf, IDC_INCFINDSTATUS, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(statusStr2Display.c_str()));
}
void FindIncrementDlg::addToRebar(ReBar * rebar)

View File

@ -87,18 +87,18 @@ END
IDB_INCREMENTAL_BG BITMAP "../icons/incrementalBg.bmp"
IDD_INCREMENT_FIND DIALOGEX 0, 0, 400, 20
IDD_INCREMENT_FIND DIALOGEX 0, 0, 680, 20
STYLE DS_SYSMODAL | DS_CONTROL | DS_FIXEDSYS | WS_CHILD | WS_CLIPCHILDREN
FONT 8, TEXT("MS Shell Dlg")
BEGIN
PUSHBUTTON "X",IDCANCEL,2,3,16,14
RTEXT "Find :",IDC_INCSTATIC,20,6,25,12
EDITTEXT IDC_INCFINDTEXT,45,6,175,10,ES_AUTOHSCROLL | ES_WANTRETURN | NOT WS_BORDER | WS_TABSTOP
PUSHBUTTON "<",IDC_INCFINDPREVOK,223,3,16,14, WS_TABSTOP
PUSHBUTTON ">",IDC_INCFINDNXTOK,243,3,16,14, WS_TABSTOP
CONTROL "&Highlight all", IDC_INCFINDHILITEALL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,270,5,65,12
CONTROL "Match &case", IDC_INCFINDMATCHCASE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,335,5,60,12
LTEXT "",IDC_INCFINDSTATUS,400,6,180,12
RTEXT "Find:",IDC_INCSTATIC,18,6,46,12
EDITTEXT IDC_INCFINDTEXT,65,6,175,10,ES_AUTOHSCROLL | ES_WANTRETURN | NOT WS_BORDER | WS_TABSTOP
PUSHBUTTON "<",IDC_INCFINDPREVOK,243,3,16,14, WS_TABSTOP
PUSHBUTTON ">",IDC_INCFINDNXTOK,263,3,16,14, WS_TABSTOP
CONTROL "Match &case", IDC_INCFINDMATCHCASE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,290,5,100,12
CONTROL "&Highlight all", IDC_INCFINDHILITEALL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,400,5,100,12
LTEXT "",IDC_INCFINDSTATUS,520,6,180,12
END
IDD_FINDRESULT DIALOGEX 26, 41, 223, 67