Make ReplaceInFiles confirmation prompt translation capable
Close #8139, close #8165
This commit is contained in:
parent
fbf6668a80
commit
924e4b23fe
@ -1265,6 +1265,9 @@ Find in all files except exe, obj && log:
|
||||
<summary-nbsel1 value=" selected characters ("/>
|
||||
<summary-nbsel2 value=" bytes) in "/>
|
||||
<summary-nbrange value=" ranges"/>
|
||||
<replace-in-files-confirm-title value="Are you sure?"/>
|
||||
<replace-in-files-confirm-directory value="Are you sure you want to replace all occurrences in :"/>
|
||||
<replace-in-files-confirm-filetype value="For file type :"/>
|
||||
</MiscStrings>
|
||||
</Native-Langue>
|
||||
</NotepadPlus>
|
||||
|
@ -1192,12 +1192,7 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
||||
if ((lstrlen(directory) > 0) && (directory[lstrlen(directory)-1] != '\\'))
|
||||
_options._directory += TEXT("\\");
|
||||
|
||||
generic_string msg = TEXT("Are you sure you want to replace all occurrences in :\r");
|
||||
msg += _options._directory;
|
||||
msg += TEXT("\rfor file type : ");
|
||||
msg += _options._filters[0]?_options._filters:TEXT("*.*");
|
||||
int res = ::MessageBox(NULL, msg.c_str(), TEXT("Are you sure?"), MB_OKCANCEL | MB_DEFBUTTON2 | MB_TASKMODAL);
|
||||
if (res == IDOK)
|
||||
if (replaceInFilesConfirmCheck(_options._directory, _options._filters))
|
||||
{
|
||||
HWND hFindCombo = ::GetDlgItem(_hSelf, IDFINDWHAT);
|
||||
_options._str2Search = getTextFromCombo(hFindCombo);
|
||||
@ -2712,12 +2707,7 @@ void FindReplaceDlg::execSavedCommand(int cmd, uptr_t intValue, const generic_st
|
||||
|
||||
case IDD_FINDINFILES_REPLACEINFILES:
|
||||
{
|
||||
generic_string msg = TEXT("Are you sure you want to replace all occurrences in :\r");
|
||||
msg += _env->_directory;
|
||||
msg += TEXT("\rfor file type : ");
|
||||
msg += (_env->_filters[0]) ? _env->_filters : TEXT("*.*");
|
||||
|
||||
if (::MessageBox(_hParent, msg.c_str(), TEXT("Are you sure?"), MB_OKCANCEL | MB_DEFBUTTON2) == IDOK)
|
||||
if (replaceInFilesConfirmCheck(_env->_directory, _env->_filters))
|
||||
{
|
||||
nppParamInst._isFindReplacing = true;
|
||||
::SendMessage(_hParent, WM_REPLACEINFILES, 0, 0);
|
||||
@ -3081,6 +3071,36 @@ void FindReplaceDlg::drawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
|
||||
::DrawText(lpDrawItemStruct->hDC, ptStr, lstrlen(ptStr), &rect, DT_SINGLELINE | DT_VCENTER | DT_LEFT);
|
||||
}
|
||||
|
||||
bool FindReplaceDlg::replaceInFilesConfirmCheck(generic_string directory, generic_string fileTypes)
|
||||
{
|
||||
bool confirmed = false;
|
||||
|
||||
NativeLangSpeaker* pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
|
||||
|
||||
generic_string title = pNativeSpeaker->getLocalizedStrFromID("replace-in-files-confirm-title", TEXT("Are you sure?"));
|
||||
|
||||
generic_string msg = pNativeSpeaker->getLocalizedStrFromID("replace-in-files-confirm-directory", TEXT("Are you sure you want to replace all occurrences in :"));
|
||||
msg += TEXT("\r\r");
|
||||
msg += directory;
|
||||
|
||||
msg += TEXT("\r\r");
|
||||
|
||||
generic_string msg2 = pNativeSpeaker->getLocalizedStrFromID("replace-in-files-confirm-filetype", TEXT("For file type :"));
|
||||
msg2 += TEXT("\r\r");
|
||||
msg2 += fileTypes[0] ? fileTypes : TEXT("*.*");
|
||||
|
||||
msg += msg2;
|
||||
|
||||
int res = ::MessageBox(NULL, msg.c_str(), title.c_str(), MB_OKCANCEL | MB_DEFBUTTON2 | MB_TASKMODAL);
|
||||
|
||||
if (res == IDOK)
|
||||
{
|
||||
confirmed = true;
|
||||
}
|
||||
|
||||
return confirmed;
|
||||
}
|
||||
|
||||
void Finder::addSearchLine(const TCHAR *searchName)
|
||||
{
|
||||
generic_string str = TEXT("Search \"");
|
||||
|
@ -410,7 +410,7 @@ private :
|
||||
static const int FR_OP_GLOBAL = 8;
|
||||
void saveInMacro(size_t cmd, int cmdType);
|
||||
void drawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
|
||||
|
||||
bool replaceInFilesConfirmCheck(generic_string directory, generic_string fileTypes);
|
||||
};
|
||||
|
||||
//FindIncrementDlg: incremental search dialog, docked in rebar
|
||||
|
Loading…
Reference in New Issue
Block a user