More translatable dialogs

This commit is contained in:
Don HO 2018-02-06 03:02:28 +01:00
parent 1a86603a0c
commit 37b30dd396
4 changed files with 97 additions and 161 deletions

View File

@ -969,6 +969,21 @@ Do you want to save the current file anyways?"/>
<LoadLangsFailed title="Configurator" message="Load langs.xml failed!
Do you want to recover your langs.xml?"/>
<LoadLangsFailedFinal title="Configurator" message="Load langs.xml failed!"/>
<FolderAsWorspaceSubfolderExists title="Folder as Worspace adding folder problem" message="A sub-folder of the folder you want to add exists.
Please remove it from the panel before you add folder &quot;$STR_REPLACE$&quot;."/>
<ProjectPanelChanged title="$STR_REPLACE$" message="The workspace was modified. Do you want to save it?"/>
<ProjectPanelChangedSaveError title="$STR_REPLACE$" message="Your workspace was not saved."/>
<ProjectPanelOpenDoSaveDirtyWsOrNot title="Open Workspace" message="The current workspace was modified. Do you want to save the current project?"/>
<ProjectPanelNewDoSaveDirtyWsOrNot title="New Workspace" message="The current workspace was modified. Do you want to save the current project?"/>
<ProjectPanelOpenFailed title="Open Workspace" message="The workspace could not be opened.
It seems the file to open is not a valid project file."/>
<ProjectPanelRemoveFolderFromProject title="Remove folder from project" message="All the sub-items will be removed.
Are you sure you want to remove this folder from the project?"/>
<ProjectPanelRemoveFileFromProject title="Remove file from project" message="Are you sure you want to remove this file from the project?"/>
<ProjectPanelReloadError title="Reload Workspace" message="Cannot find the file to reload."/>
<ProjectPanelReloadDirty title="Reload Workspace" message="The current workspace was modified. Reloading will discard all modifications.
Do you want to continue?"/>
</MessageBox>
<ClipboardHistory>
<PanelTitle name="Clipboard History"/>

View File

@ -1120,8 +1120,17 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
msg += _options._directory;
msg += TEXT("\rfor file type : ");
msg += _options._filters[0]?_options._filters:TEXT("*.*");
if (::MessageBox(_hParent, msg.c_str(), TEXT("Are you sure?"), MB_OKCANCEL|MB_DEFBUTTON2) == IDOK)
int res = ::MessageBox(_hParent, msg.c_str(), TEXT("Are you sure?"), MB_OKCANCEL | MB_DEFBUTTON2);
/*
NppParameters::getInstance()->getNativeLangSpeaker()->messageBox("FolderAsWorspaceSubfolderExists",
_hParent,
TEXT("A sub-folder of the folder you want to add exists.\rPlease remove it from the panel before you add folder \"$STR_REPLACE$\"."),
TEXT("Folder as Worspace adding folder problem"),
MB_OK,
0, // not used
_options._directory.c_str());
*/
if (res == IDOK)
{
HWND hFindCombo = ::GetDlgItem(_hSelf, IDFINDWHAT);
_options._str2Search = getTextFromCombo(hFindCombo);

View File

@ -35,6 +35,7 @@
#include "RunDlg.h"
#include "ReadDirectoryChanges.h"
#include "menuCmdID.h"
#include "Parameters.h"
#define CX_BITMAP 16
#define CY_BITMAP 16
@ -739,53 +740,6 @@ void FileBrowser::popupMenuCmd(int cmdID)
::ShellExecute(NULL, TEXT("open"), path.c_str(), NULL, NULL, SW_SHOWNORMAL);
}
break;
/*
case IDM_FILEBROWSER_RENAME :
TreeView_EditLabel(_treeView.getHSelf(), hTreeItem);
break;
case IDM_FILEBROWSER_DELETEFOLDER :
{
HTREEITEM parent = _treeView.getParent(hTreeItem);
if (_treeView.getChildFrom(hTreeItem) != NULL)
{
TCHAR str2display[MAX_PATH] = TEXT("All the sub-items will be removed.\rAre you sure you want to remove this folder from the project?");
if (::MessageBox(_hSelf, str2display, TEXT("Remove folder from project"), MB_YESNO) == IDYES)
{
_treeView.removeItem(hTreeItem);
//_folderUpdaters[0].stopWatcher();
}
}
else
{
_treeView.removeItem(hTreeItem);
}
if (getNodeType(parent) == browserNodeType_folder)
_treeView.setItemImage(parent, INDEX_CLOSED_NODE, INDEX_CLOSED_NODE);
}
break;
case IDM_FILEBROWSER_DELETEFILE :
{
HTREEITEM parent = _treeView.getParent(hTreeItem);
TCHAR str2display[MAX_PATH] = TEXT("Are you sure you want to remove this file from the project?");
if (::MessageBox(_hSelf, str2display, TEXT("Remove file from project"), MB_YESNO) == IDYES)
{
_treeView.removeItem(hTreeItem);
if (getNodeType(parent) == browserNodeType_folder)
_treeView.setItemImage(parent, INDEX_CLOSED_NODE, INDEX_CLOSED_NODE);
}
}
break;
*/
}
}
@ -926,7 +880,13 @@ void FileBrowser::addRootFolder(generic_string rootFolderPath)
if (isRelatedRootFolder(rootFolderPath, _folderUpdaters[i]->_rootFolder._rootPath))
{
::MessageBox(_hParent, TEXT("A sub-folder of the folder you want to open exists.\rPlease remove it from the panel before you add this one."), rootFolderPath.c_str(), MB_OK);
NppParameters::getInstance()->getNativeLangSpeaker()->messageBox("FolderAsWorspaceSubfolderExists",
_hParent,
TEXT("A sub-folder of the folder you want to add exists.\rPlease remove it from the panel before you add folder \"$STR_REPLACE$\"."),
TEXT("Folder as Worspace adding folder problem"),
MB_OK,
0, // not used
rootFolderPath.c_str());
return;
}
}
@ -1330,105 +1290,6 @@ LPCWSTR explainAction(DWORD dwAction)
}
};
/*
bool FolderUpdater::updateTree(DWORD action, const std::vector<generic_string> & file2Change)
{
// TCHAR msg2show[1024];
// switch (action)
// {
// case FILE_ACTION_ADDED:
// swprintf(msg2show, L"%s %s\n", explainAction(action), file2Change[0].c_str());
// printStr(msg2show);
//::PostMessage(thisFolderUpdater->_hFileBrowser, FB_ADDFILE, nullptr, reinterpret_cast<LPARAM>(wstrFilename.GetString()));
// break;
// case FILE_ACTION_REMOVED:
// swprintf(msg2show, L"%s %s\n", explainAction(action), file2Change[0].c_str());
// printStr(msg2show);
// break;
// case FILE_ACTION_RENAMED_NEW_NAME:
// swprintf(msg2show, L"%s from %s \rto %s", explainAction(action), file2Change[0].c_str(), file2Change[1].c_str());
// printStr(msg2show);
// break;
// default:
// break;
// }
generic_string separator = TEXT("\\\\");
size_t sepPos = file2Change[0].find(separator);
if (sepPos == generic_string::npos)
return false;
generic_string pathSuffix = file2Change[0].substr(sepPos + separator.length(), file2Change[0].length() - 1);
// remove prefix of file/folder in changeInfo, splite the remained path
vector<generic_string> linarPathArray = split(pathSuffix, '\\');
if (action == FILE_ACTION_ADDED)
{
generic_string rootPath = file2Change[0].substr(0, sepPos);
generic_string path = rootPath;
// search recursively and modify the tree structure
//bool foundAndModified = _rootFolder.addToStructure(path, linarPathArray);
bool foundAndModified = true;
if (foundAndModified)
{
generic_string addedFilePath = file2Change[0].substr(0, sepPos + 1);
addedFilePath += pathSuffix;
bool isAdded = _pFileBrowser->addInTree(rootPath, addedFilePath, nullptr, linarPathArray);
if (not isAdded)
MessageBox(NULL, addedFilePath.c_str(), TEXT("file/folder is not added"), MB_OK);
}
else
printStr(TEXT("addToStructure pb"));
}
else if (action == FILE_ACTION_REMOVED)
{
generic_string rootPath = file2Change[0].substr(0, sepPos);
// search recursively and modify the tree structure
//bool foundAndModified = _rootFolder.removeFromStructure(linarPathArray);
bool foundAndModified = true;
if (foundAndModified)
{
bool isRemoved = _pFileBrowser->deleteFromTree(rootPath, nullptr, linarPathArray);
if (not isRemoved)
MessageBox(NULL, file2Change[0].c_str(), TEXT("file/folder is not removed"), MB_OK);
}
else
printStr(TEXT("removeFromStructure pb"));
}
else if (action == FILE_ACTION_RENAMED_NEW_NAME)
{
generic_string rootPath = file2Change[0].substr(0, sepPos);
size_t sepPos2 = file2Change[1].find(separator);
if (sepPos2 == generic_string::npos)
return false;
generic_string pathSuffix2 = file2Change[1].substr(sepPos2 + separator.length(), file2Change[1].length() - 1);
vector<generic_string> linarPathArray2 = split(pathSuffix2, '\\');
//bool foundAndModified = _rootFolder.renameInStructure(linarPathArray, linarPathArray2);
bool foundAndModified = true;
if (foundAndModified)
{
bool isRenamed = _pFileBrowser->renameInTree(rootPath, nullptr, linarPathArray, linarPathArray2);
if (not isRenamed)
MessageBox(NULL, file2Change[0].c_str(), TEXT("file/folder is not removed"), MB_OK);
}
else
printStr(TEXT("removeFromStructure pb"));
}
return true;
}
*/
DWORD WINAPI FolderUpdater::watching(void *params)
{

View File

@ -161,11 +161,26 @@ void ProjectPanel::checkIfNeedSave(const TCHAR *title)
if (_isDirty)
{
display();
int res = ::MessageBox(_hSelf, TEXT("The workspace was modified. Do you want to save it?"), title, MB_YESNO | MB_ICONQUESTION);
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
int res = pNativeSpeaker->messageBox("ProjectPanelChanged",
_hSelf,
TEXT("The workspace was modified. Do you want to save it?"),
TEXT("$STR_REPLACE$"),
MB_YESNO | MB_ICONQUESTION,
0,
title);
if (res == IDYES)
{
if (!saveWorkSpace())
::MessageBox(_hSelf, TEXT("Your workspace was not saved."), title, MB_OK | MB_ICONERROR);
pNativeSpeaker->messageBox("ProjectPanelChangedSaveError",
_hSelf,
TEXT("Your workspace was not saved."),
TEXT("$STR_REPLACE$"),
MB_OK | MB_ICONERROR,
0,
title);
}
//else if (res == IDNO)
// Don't save so do nothing here
@ -843,7 +858,12 @@ void ProjectPanel::popupMenuCmd(int cmdID)
{
if (_isDirty)
{
int res = ::MessageBox(_hSelf, TEXT("The current workspace was modified. Do you want to save the current project?"), TEXT("New Workspace"), MB_YESNOCANCEL | MB_ICONQUESTION | MB_APPLMODAL);
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
int res = pNativeSpeaker->messageBox("ProjectPanelNewDoSaveDirtyWsOrNot",
_hSelf,
TEXT("The current workspace was modified. Do you want to save the current project?"),
TEXT("New Workspace"),
MB_YESNOCANCEL | MB_ICONQUESTION | MB_APPLMODAL);
if (res == IDYES)
{
if (!saveWorkSpace())
@ -909,9 +929,16 @@ void ProjectPanel::popupMenuCmd(int cmdID)
case IDM_PROJECT_OPENWS:
{
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
if (_isDirty)
{
int res = ::MessageBox(_hSelf, TEXT("The current workspace was modified. Do you want to save the current project?"), TEXT("Open Workspace"), MB_YESNOCANCEL | MB_ICONQUESTION | MB_APPLMODAL);
int res = pNativeSpeaker->messageBox("ProjectPanelOpenDoSaveDirtyWsOrNot",
_hSelf,
TEXT("The current workspace was modified. Do you want to save the current project?"),
TEXT("Open Workspace"),
MB_YESNOCANCEL | MB_ICONQUESTION | MB_APPLMODAL);
if (res == IDYES)
{
if (!saveWorkSpace())
@ -934,7 +961,11 @@ void ProjectPanel::popupMenuCmd(int cmdID)
{
if (!openWorkSpace(fn))
{
::MessageBox(_hSelf, TEXT("The workspace could not be opened.\rIt seems the file to open is not a valid project file."), TEXT("Open Workspace"), MB_OK);
pNativeSpeaker->messageBox("ProjectPanelOpenFailed",
_hSelf,
TEXT("The workspace could not be opened.\rIt seems the file to open is not a valid project file."),
TEXT("Open Workspace"),
MB_OK);
return;
}
}
@ -943,9 +974,15 @@ void ProjectPanel::popupMenuCmd(int cmdID)
case IDM_PROJECT_RELOADWS:
{
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
if (_isDirty)
{
int res = ::MessageBox(_hSelf, TEXT("The current workspace was modified. Reloading will discard all modifications.\rDo you want to continue?"), TEXT("Reload Workspace"), MB_YESNO | MB_ICONQUESTION | MB_APPLMODAL);
int res = pNativeSpeaker->messageBox("ProjectPanelReloadDirty",
_hSelf,
TEXT("The current workspace was modified. Reloading will discard all modifications.\rDo you want to continue?"),
TEXT("Reload Workspace"),
MB_YESNO | MB_ICONQUESTION | MB_APPLMODAL);
if (res == IDYES)
{
// Do nothing
@ -962,7 +999,11 @@ void ProjectPanel::popupMenuCmd(int cmdID)
}
else
{
::MessageBox(_hSelf, TEXT("Cannot find the file to reload."), TEXT("Reload Workspace"), MB_OK | MB_ICONEXCLAMATION | MB_APPLMODAL);
pNativeSpeaker->messageBox("ProjectPanelReloadError",
_hSelf,
TEXT("Cannot find the file to reload."),
TEXT("Reload Workspace"),
MB_OK);
}
}
break;
@ -984,8 +1025,13 @@ void ProjectPanel::popupMenuCmd(int cmdID)
if (_treeView.getChildFrom(hTreeItem) != NULL)
{
TCHAR str2display[MAX_PATH] = TEXT("All the sub-items will be removed.\rAre you sure you want to remove this folder from the project?");
if (::MessageBox(_hSelf, str2display, TEXT("Remove folder from project"), MB_YESNO) == IDYES)
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
int res = pNativeSpeaker->messageBox("ProjectPanelRemoveFolderFromProject",
_hSelf,
TEXT("All the sub-items will be removed.\rAre you sure you want to remove this folder from the project?"),
TEXT("Remove folder from project"),
MB_YESNO);
if (res == IDYES)
{
_treeView.removeItem(hTreeItem);
setWorkSpaceDirty(true);
@ -1004,9 +1050,14 @@ void ProjectPanel::popupMenuCmd(int cmdID)
case IDM_PROJECT_DELETEFILE :
{
HTREEITEM parent = _treeView.getParent(hTreeItem);
TCHAR str2display[MAX_PATH] = TEXT("Are you sure you want to remove this file from the project?");
if (::MessageBox(_hSelf, str2display, TEXT("Remove file from project"), MB_YESNO) == IDYES)
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
int res = pNativeSpeaker->messageBox("ProjectPanelRemoveFileFromProject",
_hSelf,
TEXT("Are you sure you want to remove this file from the project?"),
TEXT("Remove file from project"),
MB_YESNO);
if (res == IDYES)
{
_treeView.removeItem(hTreeItem);
setWorkSpaceDirty(true);