From ea5e36a5bee5032c3b545539915c94272c9f93d2 Mon Sep 17 00:00:00 2001 From: ozone10 Date: Tue, 9 Jul 2024 17:39:01 +0200 Subject: [PATCH] Add missing localization for debug info dialog and print error Fix #15375, fix #15105, close #15416 --- PowerEditor/installer/nativeLang/english.xml | 8 +++++++- .../installer/nativeLang/english_customizable.xml | 8 +++++++- PowerEditor/src/Notepad_plus.cpp | 5 +++++ PowerEditor/src/Notepad_plus.rc | 2 +- PowerEditor/src/NppCommands.cpp | 3 +++ PowerEditor/src/ScintillaComponent/Printer.cpp | 10 ++++++++-- PowerEditor/src/localization.cpp | 2 +- 7 files changed, 32 insertions(+), 6 deletions(-) diff --git a/PowerEditor/installer/nativeLang/english.xml b/PowerEditor/installer/nativeLang/english.xml index cbf2a7231..076cfda57 100644 --- a/PowerEditor/installer/nativeLang/english.xml +++ b/PowerEditor/installer/nativeLang/english.xml @@ -5,7 +5,7 @@ Translation note: 2. All the comments are for explanation, they are not for translation. --> - +
@@ -1396,6 +1396,11 @@ You can re-activate this dialog in Preferences later."/> + + + + + @@ -1538,6 +1543,7 @@ NOTE: Choosing not to create the placeholders or closing them later, your sessio Press the OK button to open the Find dialog or set focus on it. If you require the backward regex searching feature, consult the user manual for instructions on enabling it."/> + diff --git a/PowerEditor/installer/nativeLang/english_customizable.xml b/PowerEditor/installer/nativeLang/english_customizable.xml index 0f856e1f8..ee24252ac 100644 --- a/PowerEditor/installer/nativeLang/english_customizable.xml +++ b/PowerEditor/installer/nativeLang/english_customizable.xml @@ -5,7 +5,7 @@ Translation note: 2. All the comments are for explanation, they are not for translation. --> - +
@@ -1395,6 +1395,11 @@ You can re-activate this dialog in Preferences later."/> + + + + + @@ -1537,6 +1542,7 @@ NOTE: Choosing not to create the placeholders or closing them later, your sessio Press the OK button to open the Find dialog or set focus on it. If you require the backward regex searching feature, consult the user manual for instructions on enabling it."/> + diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 9cb38caea..0609af3fc 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -7222,6 +7222,11 @@ bool Notepad_plus::reloadLang() _nativeLangSpeaker.changePluginsAdminDlgLang(_pluginsAdminDlg); } + if (_debugInfoDlg.isCreated()) + { + _nativeLangSpeaker.changeDlgLang(_debugInfoDlg.getHSelf(), "DebugInfo"); + } + UserDefineDialog *udd = _pEditView->getUserDefineDlg(); if (udd->isCreated()) { diff --git a/PowerEditor/src/Notepad_plus.rc b/PowerEditor/src/Notepad_plus.rc index 743e1b48c..4dfa08c22 100644 --- a/PowerEditor/src/Notepad_plus.rc +++ b/PowerEditor/src/Notepad_plus.rc @@ -1347,7 +1347,7 @@ FONT 8, TEXT("MS Shell Dlg"), 0, 0, 0x1 BEGIN GROUPBOX "",IDC_STATIC,8,3,230,151,BS_CENTER EDITTEXT IDC_DEBUGINFO_EDIT,18,16,210,128,ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | NOT WS_BORDER | WS_VSCROLL - PUSHBUTTON "&Copy debug info into clipboard",IDC_DEBUGINFO_COPYLINK,8,157,126,14 + PUSHBUTTON "&Copy debug info to clipboard",IDC_DEBUGINFO_COPYLINK,8,157,126,14 DEFPUSHBUTTON "OK",IDOK,98,175,50,14 END diff --git a/PowerEditor/src/NppCommands.cpp b/PowerEditor/src/NppCommands.cpp index 45890ea97..f792a1f60 100644 --- a/PowerEditor/src/NppCommands.cpp +++ b/PowerEditor/src/NppCommands.cpp @@ -3549,7 +3549,10 @@ void Notepad_plus::command(int id) case IDM_DEBUGINFO: { + const bool isFirstTime = !_debugInfoDlg.isCreated(); _debugInfoDlg.doDialog(); + if (isFirstTime) + _nativeLangSpeaker.changeDlgLang(_debugInfoDlg.getHSelf(), "DebugInfo"); break; } diff --git a/PowerEditor/src/ScintillaComponent/Printer.cpp b/PowerEditor/src/ScintillaComponent/Printer.cpp index 18f75a4d1..23330375f 100644 --- a/PowerEditor/src/ScintillaComponent/Printer.cpp +++ b/PowerEditor/src/ScintillaComponent/Printer.cpp @@ -17,6 +17,7 @@ #include "Printer.h" #include "RunDlg.h" +#include "localization.h" using namespace std; @@ -180,9 +181,14 @@ size_t Printer::doPrint(bool justDoIt) docInfo.lpszOutput = NULL; docInfo.lpszDatatype = NULL; - if (::StartDoc(_pdlg.hDC, &docInfo) < 0) + if (::StartDoc(_pdlg.hDC, &docInfo) < 0) { - MessageBox(NULL, L"Can not start printer document.", 0, MB_OK); + NativeLangSpeaker* pNativeSpeaker = NppParameters::getInstance().getNativeLangSpeaker(); + pNativeSpeaker->messageBox("PrintError", + nullptr, + L"Cannot start printer document.", + L"", + MB_OK); return 0; } diff --git a/PowerEditor/src/localization.cpp b/PowerEditor/src/localization.cpp index 66d6c3fd6..b81f0efa1 100644 --- a/PowerEditor/src/localization.cpp +++ b/PowerEditor/src/localization.cpp @@ -1583,7 +1583,7 @@ int NativeLangSpeaker::messageBox(const char *msgBoxTagName, HWND hWnd, const wc { msgBoxType |= MB_RTLREADING | MB_RIGHT; } - return ::MessageBox(hWnd, msg.c_str(), title.c_str(), msgBoxType); + return ::MessageBox(hWnd, msg.c_str(), (title.empty() || wcscmp(title.c_str(), L"0") == 0) ? nullptr : title.c_str(), msgBoxType); } // Default English localization during Notepad++ launch