Fix translation issue for Dock/Undock label in User-Defined dialog
Fix 8020, close #13127pull/13148/head
parent
4a4f96cefc
commit
9627494043
|
@ -722,6 +722,7 @@ The comments are here for explanation, it's not necessary to translate them.
|
|||
<Item id="20011" name="Transparency"/>
|
||||
<Item id="20015" name="Import..."/>
|
||||
<Item id="20016" name="Export..."/>
|
||||
<Item id="20017" name="Undock"/>
|
||||
<StylerDialog title="Styler Dialog">
|
||||
<Item id="25030" name="Font options:"/>
|
||||
<Item id="25006" name="Foreground color"/>
|
||||
|
|
|
@ -650,6 +650,7 @@
|
|||
<Item id="20011" name="Transparency"/>
|
||||
<Item id="20015" name="Import..."/>
|
||||
<Item id="20016" name="Export..."/>
|
||||
<Item id="20017" name="Undock"/>
|
||||
<StylerDialog title="Styler Dialog">
|
||||
<Item id="25030" name="Font options:"/>
|
||||
<Item id="25006" name="Foreground colour"/>
|
||||
|
|
|
@ -925,9 +925,32 @@ void UserDefineDialog::reloadLangCombo()
|
|||
void UserDefineDialog::changeStyle()
|
||||
{
|
||||
_status = !_status;
|
||||
::SetDlgItemText(_hSelf, IDC_DOCK_BUTTON, (_status == DOCK)?TEXT("Undock"):TEXT("Dock"));
|
||||
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
|
||||
TiXmlNodeA *targetNode = nullptr;
|
||||
if (pNativeSpeaker->getNativeLangA())
|
||||
{
|
||||
targetNode = (pNativeSpeaker->getNativeLangA())->FirstChildElement("Dialog");
|
||||
if (targetNode)
|
||||
targetNode = targetNode->FirstChildElement("UserDefine");
|
||||
}
|
||||
generic_string dockButtonLabel;
|
||||
generic_string defauleLabel;
|
||||
string idStr;
|
||||
if (_status == DOCK)
|
||||
{
|
||||
defauleLabel = TEXT("Undock");
|
||||
idStr = std::to_string(IDC_UNDOCK_BUTTON);
|
||||
}
|
||||
else
|
||||
{
|
||||
defauleLabel = TEXT("Dock");
|
||||
idStr = std::to_string(IDC_DOCK_BUTTON);
|
||||
}
|
||||
|
||||
auto style = ::GetWindowLongPtr(_hSelf, GWL_STYLE);
|
||||
dockButtonLabel= pNativeSpeaker->getAttrNameByIdStr(defauleLabel.c_str(), targetNode, idStr.c_str());
|
||||
::SetDlgItemText(_hSelf, IDC_DOCK_BUTTON, dockButtonLabel.c_str());
|
||||
|
||||
auto style = ::GetWindowLongPtr(_hSelf, GWL_STYLE);
|
||||
if (!style)
|
||||
::MessageBox(NULL, TEXT("GetWindowLongPtr failed in UserDefineDialog::changeStyle()"), TEXT(""), MB_OK);
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#define IDC_AUTOCOMPLET_STATIC (IDD_GLOBAL_USERDEFINE_DLG + 14)
|
||||
#define IDC_IMPORT_BUTTON (IDD_GLOBAL_USERDEFINE_DLG + 15)
|
||||
#define IDC_EXPORT_BUTTON (IDD_GLOBAL_USERDEFINE_DLG + 16)
|
||||
#define IDC_UNDOCK_BUTTON (IDD_GLOBAL_USERDEFINE_DLG + 17)
|
||||
|
||||
#define IDD_FOLDER_STYLE_DLG 21000 // IDD_GLOBAL_USERDEFINE_DLG + 1000
|
||||
#define IDC_DEFAULT (IDD_FOLDER_STYLE_DLG + 100)
|
||||
|
|
|
@ -1331,6 +1331,29 @@ generic_string NativeLangSpeaker::getAttrNameStr(const TCHAR *defaultStr, const
|
|||
return defaultStr;
|
||||
}
|
||||
|
||||
generic_string NativeLangSpeaker::getAttrNameByIdStr(const TCHAR *defaultStr, TiXmlNodeA *targetNode, const char *nodeL1Value, const char *nodeL1Name, const char *nodeL2Name) const
|
||||
{
|
||||
if (!targetNode) return defaultStr;
|
||||
|
||||
for (TiXmlNodeA *childNode = targetNode->FirstChildElement("Item");
|
||||
childNode;
|
||||
childNode = childNode->NextSibling("Item"))
|
||||
{
|
||||
TiXmlElementA *element = childNode->ToElement();
|
||||
const char *id = element->Attribute(nodeL1Name);
|
||||
if (id && id[0] && !strcmp(id, nodeL1Value))
|
||||
{
|
||||
const char *name = element->Attribute(nodeL2Name);
|
||||
if (name && name[0])
|
||||
{
|
||||
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||
return wmc.char2wchar(name, _nativeLangEncoding);
|
||||
}
|
||||
}
|
||||
}
|
||||
return defaultStr;
|
||||
}
|
||||
|
||||
int NativeLangSpeaker::messageBox(const char *msgBoxTagName, HWND hWnd, const TCHAR *defaultMessage, const TCHAR *defaultTitle, int msgBoxType, int intInfo, const TCHAR *strInfo)
|
||||
{
|
||||
if ((NppParameters::getInstance()).isEndSessionCritical())
|
||||
|
|
|
@ -80,6 +80,7 @@ public:
|
|||
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, const char *nodeL3Name = "name") const;
|
||||
generic_string getAttrNameByIdStr(const TCHAR *defaultStr, TiXmlNodeA *targetNode, const char *nodeL1Value, const char *nodeL1Name = "id", const char *nodeL2Name = "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);
|
||||
|
|
Loading…
Reference in New Issue