Skip to content

Commit

Permalink
Make new entries translatable
Browse files Browse the repository at this point in the history
  • Loading branch information
donho committed Mar 2, 2018
1 parent 8c84e92 commit 789cf38
Show file tree
Hide file tree
Showing 8 changed files with 223 additions and 191 deletions.
141 changes: 81 additions & 60 deletions PowerEditor/installer/nativeLang/chinese.xml

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions PowerEditor/installer/nativeLang/english.xml
Expand Up @@ -931,6 +931,19 @@
<Item id="1" name="OK"/>
<Item id="2" name="Cancel"/>
</ColumnEditor>
<FindInFinder title="Find in finder">
<Item id="1" name="Find All"/>
<Item id="2" name="Close"/>
<Item id="1711" name="Find what:"/>
<Item id="1713" name="Search only in found lines"/>
<Item id="1714" name="Match &amp;whole word only"/>
<Item id="1715" name="Match &amp;case"/>
<Item id="1716" name="Search mode"/>
<Item id="1717" name="Normal"/>
<Item id="1719" name="Regular &amp;expression"/>
<Item id="1718" name="Extended (\n, \r, \t, \0, \x...)"/>
<Item id="1720" name="&amp;. matches newline"/>
</FindInFinder>
</Dialog>
<MessageBox> <!-- $INT_REPLACE$ is a place holder, don't translate it -->
<ContextMenuXmlEditWarning title="Editing contextMenu" message="Editing contextMenu.xml allows you to modify your Notepad++ popup context menu.
Expand Down Expand Up @@ -1142,6 +1155,14 @@ please give another one."/>
<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;"/>
<finder-find-in-finder value="Find in this found results..."/>
<finder-close-this value="Close this finder"/>
<finder-collapse-all value="Collapse all"/>
<finder-uncollapse-all value="Uncollapse all"/>
<finder-copy value="Copy"/>
<finder-select-all value="Select all"/>
<finder-clear-all value="Clear all"/>
<finder-open-all value="Open all"/>
</MiscStrings>
</Native-Langue>
</NotepadPlus>
157 changes: 89 additions & 68 deletions PowerEditor/installer/nativeLang/french.xml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion PowerEditor/src/NppCommands.cpp
Expand Up @@ -2960,7 +2960,7 @@ void Notepad_plus::command(int id)
if (dlgNode)
dlgNode = _nativeLangSpeaker.searchDlgNode(dlgNode, "Window");
}
_windowsDlg.doDialog(dlgNode);
_windowsDlg.doDialog();
}
break;

Expand Down
34 changes: 25 additions & 9 deletions PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp
Expand Up @@ -672,8 +672,12 @@ INT_PTR CALLBACK FindInFinderDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
switch (message)
{
case WM_INITDIALOG:
{
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
pNativeSpeaker->changeDlgLang(_hSelf, "FindInFinder");
initFromOptions();
return TRUE;
}
return TRUE;

case WM_COMMAND:
{
Expand Down Expand Up @@ -3257,18 +3261,30 @@ INT_PTR CALLBACK Finder::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
::GetCursorPos(&p);
ContextMenu scintillaContextmenu;
vector<MenuItemUnit> tmp;
tmp.push_back(MenuItemUnit(NPPM_INTERNAL_FINDINFINDERDLG, TEXT("Find in this finder...")));

NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();

generic_string findInFinder = pNativeSpeaker->getLocalizedStrFromID("finder-find-in-finder", TEXT("Find in these found results..."));
generic_string closeThis = pNativeSpeaker->getLocalizedStrFromID("finder-close-this", TEXT("Close this finder"));
generic_string collapseAll = pNativeSpeaker->getLocalizedStrFromID("finder-collapse-all", TEXT("Collapse all"));
generic_string uncollapseAll = pNativeSpeaker->getLocalizedStrFromID("finder-uncollapse-all", TEXT("Uncollapse all"));
generic_string copy = pNativeSpeaker->getLocalizedStrFromID("finder-copy", TEXT("Copy"));
generic_string selectAll = pNativeSpeaker->getLocalizedStrFromID("finder-select-all", TEXT("Select all"));
generic_string clearAll = pNativeSpeaker->getLocalizedStrFromID("finder-clear-all", TEXT("Clear all"));
generic_string openAll = pNativeSpeaker->getLocalizedStrFromID("finder-open-all", TEXT("Open all"));

tmp.push_back(MenuItemUnit(NPPM_INTERNAL_FINDINFINDERDLG, findInFinder));
if (_canBeVolatiled)
tmp.push_back(MenuItemUnit(NPPM_INTERNAL_REMOVEFINDER, TEXT("Close this finder")));
tmp.push_back(MenuItemUnit(NPPM_INTERNAL_REMOVEFINDER, closeThis));
tmp.push_back(MenuItemUnit(0, TEXT("Separator")));
tmp.push_back(MenuItemUnit(NPPM_INTERNAL_SCINTILLAFINFERCOLLAPSE, TEXT("Collapse all")));
tmp.push_back(MenuItemUnit(NPPM_INTERNAL_SCINTILLAFINFERUNCOLLAPSE, TEXT("Uncollapse all")));
tmp.push_back(MenuItemUnit(NPPM_INTERNAL_SCINTILLAFINFERCOLLAPSE, collapseAll));
tmp.push_back(MenuItemUnit(NPPM_INTERNAL_SCINTILLAFINFERUNCOLLAPSE, uncollapseAll));
tmp.push_back(MenuItemUnit(0, TEXT("Separator")));
tmp.push_back(MenuItemUnit(NPPM_INTERNAL_SCINTILLAFINFERCOPY, TEXT("Copy")));
tmp.push_back(MenuItemUnit(NPPM_INTERNAL_SCINTILLAFINFERSELECTALL, TEXT("Select all")));
tmp.push_back(MenuItemUnit(NPPM_INTERNAL_SCINTILLAFINFERCLEARALL, TEXT("Clear all")));
tmp.push_back(MenuItemUnit(NPPM_INTERNAL_SCINTILLAFINFERCOPY, copy));
tmp.push_back(MenuItemUnit(NPPM_INTERNAL_SCINTILLAFINFERSELECTALL, selectAll));
tmp.push_back(MenuItemUnit(NPPM_INTERNAL_SCINTILLAFINFERCLEARALL, clearAll));
tmp.push_back(MenuItemUnit(0, TEXT("Separator")));
tmp.push_back(MenuItemUnit(NPPM_INTERNAL_SCINTILLAFINFEROPENALL, TEXT("Open all")));
tmp.push_back(MenuItemUnit(NPPM_INTERNAL_SCINTILLAFINFEROPENALL, openAll));

scintillaContextmenu.create(_hSelf, tmp);

Expand Down
4 changes: 2 additions & 2 deletions PowerEditor/src/ScitillaComponent/FindReplaceDlg.rc
Expand Up @@ -116,7 +116,7 @@ END
IDD_FINDINFINDER_DLG DIALOGEX 36, 44, 367, 200
STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_TOOLWINDOW
CAPTION "Find in finder"
CAPTION "Find in found results"
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
RTEXT "&Find what :",IDFINDWHAT_STATIC_FIFOLDER,6,22,75,8
Expand All @@ -130,7 +130,7 @@ BEGIN
CONTROL "E&xtended (\\n, \\r, \\t, \\0, \\x...)",IDEXTENDED_FIFOLDER, "Button",BS_AUTORADIOBUTTON,12,155,145,10
CONTROL "Re&gular expression",IDREGEXP_FIFOLDER,"Button",BS_AUTORADIOBUTTON,12,167,78,10
CONTROL "&. matches newline",IDREDOTMATCHNL_FIFOLDER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,93,167,68,9
PUSHBUTTON "Find all",IDOK,268,20,90,14,WS_GROUP
PUSHBUTTON "Find All",IDOK,268,20,90,14,WS_GROUP
PUSHBUTTON "Close",IDCANCEL,268,38,90,14
END

Expand Down
50 changes: 3 additions & 47 deletions PowerEditor/src/WinControls/WindowsDlg/WindowsDlg.cpp
Expand Up @@ -238,7 +238,8 @@ INT_PTR CALLBACK WindowsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPa
{
case WM_INITDIALOG :
{
changeDlgLang();
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
pNativeSpeaker->changeDlgLang(_hSelf, "Window");
return MyBaseClass::run_dlgProc(message, wParam, lParam);
}

Expand Down Expand Up @@ -461,56 +462,11 @@ void WindowsDlg::updateButtonState()
EnableWindow(GetDlgItem(_hSelf, IDC_WINDOWS_SORT), TRUE);
}

int WindowsDlg::doDialog(TiXmlNodeA *dlgNode)
int WindowsDlg::doDialog()
{
_dlgNode = dlgNode;
return static_cast<int>(DialogBoxParam(_hInst, MAKEINTRESOURCE(IDD_WINDOWS), _hParent, dlgProc, reinterpret_cast<LPARAM>(this)));
};

bool WindowsDlg::changeDlgLang()
{
if (!_dlgNode) return false;

WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
int nativeLangEncoding = CP_ACP;
TiXmlDeclarationA *declaration = _dlgNode->GetDocument()->FirstChild()->ToDeclaration();
if (declaration)
{
const char * encodingStr = declaration->Encoding();
EncodingMapper *em = EncodingMapper::getInstance();
nativeLangEncoding = em->getEncodingFromString(encodingStr);
}

// Set Title
const char *titre = (_dlgNode->ToElement())->Attribute("title");
if (titre && titre[0])
{
const wchar_t *nameW = wmc->char2wchar(titre, nativeLangEncoding);
::SetWindowText(_hSelf, nameW);
}

// Set the text of child control
for (TiXmlNodeA *childNode = _dlgNode->FirstChildElement("Item");
childNode ;
childNode = childNode->NextSibling("Item") )
{
TiXmlElementA *element = childNode->ToElement();
int id;
const char *sentinel = element->Attribute("id", &id);
const char *name = element->Attribute("name");
if (sentinel && (name && name[0]))
{
HWND hItem = ::GetDlgItem(_hSelf, id);
if (hItem)
{
const wchar_t *nameW = wmc->char2wchar(name, nativeLangEncoding);
::SetWindowText(hItem, nameW);
}
}
}
return true;
}

BOOL WindowsDlg::onInitDialog()
{
_winMgr.InitToFitSizeFromCurrent(_hSelf);
Expand Down
5 changes: 1 addition & 4 deletions PowerEditor/src/WinControls/WindowsDlg/WindowsDlg.h
Expand Up @@ -32,7 +32,6 @@
#include "Common.h"

class DocTabView;
class TiXmlNodeA;

typedef enum {
WDT_ACTIVATE = 1,
Expand Down Expand Up @@ -69,11 +68,10 @@ class WindowsDlg : public SizeableDlg

public :
WindowsDlg();
int doDialog(TiXmlNodeA *dlgNode);
int doDialog();
virtual void init(HINSTANCE hInst, HWND parent, DocTabView *pTab);

void doRefresh(bool invalidate = false);
bool changeDlgLang();

protected :
virtual INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
Expand Down Expand Up @@ -101,7 +99,6 @@ protected :
int _currentColumn = -1;
int _lastSort = -1;
bool _reverseSort = false;
TiXmlNodeA *_dlgNode = nullptr;

private:
virtual void init(HINSTANCE hInst, HWND parent);
Expand Down

0 comments on commit 789cf38

Please sign in to comment.