diff --git a/PowerEditor/installer/nativeLang/english.xml b/PowerEditor/installer/nativeLang/english.xml index aa29aa4b..a1efcbfc 100644 --- a/PowerEditor/installer/nativeLang/english.xml +++ b/PowerEditor/installer/nativeLang/english.xml @@ -610,6 +610,9 @@ + + + diff --git a/PowerEditor/src/NppIO.cpp b/PowerEditor/src/NppIO.cpp index 4e3d2b08..115e4d5e 100644 --- a/PowerEditor/src/NppIO.cpp +++ b/PowerEditor/src/NppIO.cpp @@ -197,9 +197,10 @@ BufferID Notepad_plus::doOpen(const TCHAR *fileName, bool isReadOnly, int encodi { int answer = _nativeLangSpeaker.messageBox("NbFileToOpenImportantWaring", _pPublicInterface->getHSelf(), - TEXT("Number of files to open are too important.\rAre you sure to open them?"), - TEXT("Amount of files to open is too large"), - MB_YESNO|MB_APPLMODAL); + TEXT("$INT_REPLACE$ files are about to be opened.\rAre you sure to open them?"), + TEXT("Amount of files to open is too large"), + MB_YESNO|MB_APPLMODAL, + nbFiles2Open); ok2Open = answer == IDYES; } diff --git a/PowerEditor/src/ScitillaComponent/Buffer.cpp b/PowerEditor/src/ScitillaComponent/Buffer.cpp index f4da4b26..3e074bd6 100644 --- a/PowerEditor/src/ScitillaComponent/Buffer.cpp +++ b/PowerEditor/src/ScitillaComponent/Buffer.cpp @@ -739,6 +739,13 @@ bool FileManager::loadFileData(Document doc, const TCHAR * filename, Utf8_16_Rea if(bufferSizeRequested > INT_MAX) { ::MessageBox(NULL, TEXT("File is too big to be opened by Notepad++"), TEXT("File open problem"), MB_OK|MB_APPLMODAL); + /* + _nativeLangSpeaker.messageBox("NbFileToOpenImportantWaring", + _pPublicInterface->getHSelf(), + TEXT("File is too big to be opened by Notepad++"), + TEXT("File open problem"), + MB_OK|MB_APPLMODAL); + */ fclose(fp); return false; } diff --git a/PowerEditor/src/localization.cpp b/PowerEditor/src/localization.cpp index 9987b28b..f3d23b9a 100644 --- a/PowerEditor/src/localization.cpp +++ b/PowerEditor/src/localization.cpp @@ -1321,12 +1321,49 @@ generic_string NativeLangSpeaker::getProjectPanelLangStr(const char *nodeName, c return defaultStr; } -int NativeLangSpeaker::messageBox(const char *msgBoxTagName, HWND hWnd, TCHAR *defaultMessage, TCHAR *defaultTitle, int msgBoxType) +int NativeLangSpeaker::messageBox(const char *msgBoxTagName, HWND hWnd, TCHAR *defaultMessage, TCHAR *defaultTitle, int msgBoxType, int intInfo, TCHAR *strInfo) { generic_string msg, title; - if (getMsgBoxLang(msgBoxTagName, title, msg)) + size_t index; + TCHAR int2Write[256]; + TCHAR intPlaceHolderSymbol[] = TEXT("$INT_REPLACE$"); + TCHAR strPlaceHolderSymbol[] = TEXT("$STR_REPLACE$"); + + size_t intPlaceHolderLen = lstrlen(intPlaceHolderSymbol); + size_t strPlaceHolderLen = lstrlen(strPlaceHolderSymbol); + + generic_sprintf(int2Write, TEXT("%d"), intInfo); + + if (!getMsgBoxLang(msgBoxTagName, title, msg)) { - return ::MessageBox(hWnd, msg.c_str(), title.c_str(), msgBoxType); + title = defaultTitle; + msg = defaultMessage; } + index = title.find(intPlaceHolderSymbol); + if (index != string::npos) + title.replace(index, intPlaceHolderLen, int2Write); + + index = msg.find(intPlaceHolderSymbol); + if (index != string::npos) + msg.replace(index, intPlaceHolderLen, int2Write); + + if (strInfo) + { + index = title.find(strPlaceHolderSymbol); + if (index != string::npos) + title.replace(index, strPlaceHolderLen, strInfo); + + index = msg.find(strPlaceHolderSymbol); + if (index != string::npos) + msg.replace(index, strPlaceHolderLen, strInfo); + } + return ::MessageBox(hWnd, msg.c_str(), title.c_str(), msgBoxType); + + /* + defaultTitle.replace(index, len, int2Write); + defaultTitle.replace(index, len, str2Write); + defaultMessage.replace(index, len, int2Write); + defaultMessage.replace(index, len, str2Write); return ::MessageBox(hWnd, defaultMessage, defaultTitle, msgBoxType); + */ } \ No newline at end of file diff --git a/PowerEditor/src/localization.h b/PowerEditor/src/localization.h index ba6704e0..47349ea6 100644 --- a/PowerEditor/src/localization.h +++ b/PowerEditor/src/localization.h @@ -74,7 +74,7 @@ public: bool getMsgBoxLang(const char *msgBoxTagName, generic_string & title, generic_string & message); generic_string getProjectPanelLangMenuStr(const char * nodeName, int cmdID, const TCHAR *defaultStr) const; generic_string getProjectPanelLangStr(const char *nodeName, const TCHAR *defaultStr) const; - int messageBox(const char *msgBoxTagName, HWND hWnd, TCHAR *message, TCHAR *title, int msgBoxType); + int messageBox(const char *msgBoxTagName, HWND hWnd, TCHAR *message, TCHAR *title, int msgBoxType, int intInfo = 0, TCHAR *strInfo = NULL); private: TiXmlNodeA *_nativeLangA; int _nativeLangEncoding;