From 0546f75a71ca54ab636fd5433d2c800cdc12049f Mon Sep 17 00:00:00 2001 From: Don HO Date: Wed, 16 Dec 2020 18:49:06 +0100 Subject: [PATCH] Make "total documents number" feature in Window dialog translatable --- PowerEditor/installer/nativeLang/english.xml | 1 + PowerEditor/installer/nativeLang/french.xml | 1 + .../installer/nativeLang/taiwaneseMandarin.xml | 1 + .../src/WinControls/WindowsDlg/WindowsDlg.cpp | 14 ++++++-------- PowerEditor/src/localization.cpp | 4 ++-- PowerEditor/src/localization.h | 2 +- 6 files changed, 12 insertions(+), 11 deletions(-) diff --git a/PowerEditor/installer/nativeLang/english.xml b/PowerEditor/installer/nativeLang/english.xml index 6fe9c175..29aee9b5 100644 --- a/PowerEditor/installer/nativeLang/english.xml +++ b/PowerEditor/installer/nativeLang/english.xml @@ -1214,6 +1214,7 @@ Continue?"/> + diff --git a/PowerEditor/installer/nativeLang/french.xml b/PowerEditor/installer/nativeLang/french.xml index f6078ef5..7a051a8b 100644 --- a/PowerEditor/installer/nativeLang/french.xml +++ b/PowerEditor/installer/nativeLang/french.xml @@ -1170,6 +1170,7 @@ Voulez-vous les poursuivez ?"/> + diff --git a/PowerEditor/installer/nativeLang/taiwaneseMandarin.xml b/PowerEditor/installer/nativeLang/taiwaneseMandarin.xml index df781244..85734fdd 100644 --- a/PowerEditor/installer/nativeLang/taiwaneseMandarin.xml +++ b/PowerEditor/installer/nativeLang/taiwaneseMandarin.xml @@ -1160,6 +1160,7 @@ + diff --git a/PowerEditor/src/WinControls/WindowsDlg/WindowsDlg.cpp b/PowerEditor/src/WinControls/WindowsDlg/WindowsDlg.cpp index 04441dd5..fa56b6de 100644 --- a/PowerEditor/src/WinControls/WindowsDlg/WindowsDlg.cpp +++ b/PowerEditor/src/WinControls/WindowsDlg/WindowsDlg.cpp @@ -49,7 +49,7 @@ using namespace std; #define WD_CLMNPATH "ColumnPath" #define WD_CLMNTYPE "ColumnType" #define WD_CLMNSIZE "ColumnSize" -#define WD_TABTOTAL "TabsTotal" +#define WD_NBDOCSTOTAL "NbDocsTotal" static const TCHAR *readonlyString = TEXT(" [Read Only]"); const UINT WDN_NOTIFY = RegisterWindowMessage(TEXT("WDN_NOTIFY")); @@ -875,13 +875,11 @@ void WindowsDlg::doClose() void WindowsDlg::doCount() { NativeLangSpeaker* pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker(); - - TCHAR count[32]; - wsprintf(count, TEXT("%d"), _idxMap.size()); - - generic_string msg = TEXT("Windows -- "); - msg += pNativeSpeaker->getAttrNameStr(TEXT("Total documents opened: "), WD_ROOTNODE, WD_TABTOTAL); - msg += count; + + generic_string msg = pNativeSpeaker->getAttrNameStr(TEXT("Windows"), "Dialog", "Window", "title"); + msg += TEXT(" - "); + msg += pNativeSpeaker->getAttrNameStr(TEXT("Total documents: "), WD_ROOTNODE, WD_NBDOCSTOTAL); + msg += to_wstring(_idxMap.size()); SetWindowText(_hSelf,msg.c_str()); } diff --git a/PowerEditor/src/localization.cpp b/PowerEditor/src/localization.cpp index daa1300c..e8e1a66a 100644 --- a/PowerEditor/src/localization.cpp +++ b/PowerEditor/src/localization.cpp @@ -1330,7 +1330,7 @@ generic_string NativeLangSpeaker::getProjectPanelLangMenuStr(const char * nodeNa return defaultStr; } -generic_string NativeLangSpeaker::getAttrNameStr(const TCHAR *defaultStr, const char *nodeL1Name, const char *nodeL2Name) const +generic_string NativeLangSpeaker::getAttrNameStr(const TCHAR *defaultStr, const char *nodeL1Name, const char *nodeL2Name, const char *nodeL3Name) const { if (!_nativeLangA) return defaultStr; @@ -1341,7 +1341,7 @@ generic_string NativeLangSpeaker::getAttrNameStr(const TCHAR *defaultStr, const if (!targetNode) return defaultStr; - const char *name = (targetNode->ToElement())->Attribute("name"); + const char *name = (targetNode->ToElement())->Attribute(nodeL3Name); if (name && name[0]) { WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); diff --git a/PowerEditor/src/localization.h b/PowerEditor/src/localization.h index 2e01c59d..647a921b 100644 --- a/PowerEditor/src/localization.h +++ b/PowerEditor/src/localization.h @@ -90,7 +90,7 @@ public: generic_string getShortcutMapperLangStr(const char *nodeName, const TCHAR *defaultStr) const; generic_string getProjectPanelLangMenuStr(const char * nodeName, int cmdID, const TCHAR *defaultStr) const; generic_string getFileBrowserLangMenuStr(int cmdID, const TCHAR *defaultStr) const; - generic_string getAttrNameStr(const TCHAR *defaultStr, const char *nodeL1Name, const char *nodeL2Name = NULL) const; + generic_string getAttrNameStr(const TCHAR *defaultStr, const char *nodeL1Name, const char *nodeL2Name, const char *nodeL3Name = "name") const; generic_string getLocalizedStrFromID(const char *strID, const generic_string& defaultString) const; int messageBox(const char *msgBoxTagName, HWND hWnd, const TCHAR *message, const TCHAR *title, int msgBoxType, int intInfo = 0, const TCHAR *strInfo = NULL);