From 3220eaaa30243229663b8a6d3ecd5844079790df Mon Sep 17 00:00:00 2001 From: Don HO Date: Thu, 21 Nov 2019 02:24:57 +0100 Subject: [PATCH] Refine "Open UDL folder" command & make it translatable --- PowerEditor/installer/nativeLang/chinese.xml | 2 ++ PowerEditor/installer/nativeLang/english.xml | 8 +++++--- PowerEditor/installer/nativeLang/french.xml | 4 +++- PowerEditor/src/NppCommands.cpp | 8 ++++---- PowerEditor/src/Parameters.cpp | 6 +++--- PowerEditor/src/Parameters.h | 9 +++++++++ PowerEditor/src/localization.cpp | 8 +++++--- 7 files changed, 31 insertions(+), 14 deletions(-) diff --git a/PowerEditor/installer/nativeLang/chinese.xml b/PowerEditor/installer/nativeLang/chinese.xml index f09bfd6b1..d2c8eed92 100644 --- a/PowerEditor/installer/nativeLang/chinese.xml +++ b/PowerEditor/installer/nativeLang/chinese.xml @@ -63,6 +63,7 @@ + @@ -283,6 +284,7 @@ + diff --git a/PowerEditor/installer/nativeLang/english.xml b/PowerEditor/installer/nativeLang/english.xml index ac10fad2e..71977218e 100644 --- a/PowerEditor/installer/nativeLang/english.xml +++ b/PowerEditor/installer/nativeLang/english.xml @@ -63,9 +63,10 @@ - - - + + + + @@ -281,6 +282,7 @@ + diff --git a/PowerEditor/installer/nativeLang/french.xml b/PowerEditor/installer/nativeLang/french.xml index 62d7b7a06..e23b63fe7 100644 --- a/PowerEditor/installer/nativeLang/french.xml +++ b/PowerEditor/installer/nativeLang/french.xml @@ -63,6 +63,7 @@ + @@ -282,6 +283,7 @@ + @@ -313,7 +315,7 @@ - + diff --git a/PowerEditor/src/NppCommands.cpp b/PowerEditor/src/NppCommands.cpp index fe9b29b3d..d43ed45c3 100644 --- a/PowerEditor/src/NppCommands.cpp +++ b/PowerEditor/src/NppCommands.cpp @@ -3049,10 +3049,10 @@ void Notepad_plus::command(int id) } break; - case IDM_LANG_OPENUDLDIR: { - generic_string _userPath = NppParameters::getInstance().getUserPath(); - PathAppend(_userPath, TEXT("userDefineLangs")); - ::ShellExecute(_pPublicInterface->getHSelf(), TEXT("open"), _userPath.c_str(), NULL, NULL, SW_SHOW); + case IDM_LANG_OPENUDLDIR: + { + generic_string userDefineLangFolderPath = NppParameters::getInstance().getUserDefineLangFolderPath(); + ::ShellExecute(_pPublicInterface->getHSelf(), TEXT("open"), userDefineLangFolderPath.c_str(), NULL, NULL, SW_SHOW); break; } diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index f17d865de..d7bed6914 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -1230,12 +1230,12 @@ bool NppParameters::load() //-----------------------------------// // userDefineLang.xml : for per user // //-----------------------------------// - generic_string userDefineLangsFolderPath = _userDefineLangPath = _userPath; + _userDefineLangsFolderPath = _userDefineLangPath = _userPath; PathAppend(_userDefineLangPath, TEXT("userDefineLang.xml")); - PathAppend(userDefineLangsFolderPath, TEXT("userDefineLangs")); + PathAppend(_userDefineLangsFolderPath, TEXT("userDefineLangs")); std::vector udlFiles; - getFilesInFolder(udlFiles, TEXT("*.xml"), userDefineLangsFolderPath); + getFilesInFolder(udlFiles, TEXT("*.xml"), _userDefineLangsFolderPath); _pXmlUserLangDoc = new TiXmlDocument(_userDefineLangPath); loadOkay = _pXmlUserLangDoc->LoadFile(); diff --git a/PowerEditor/src/Parameters.h b/PowerEditor/src/Parameters.h index b303b12bc..715be818d 100644 --- a/PowerEditor/src/Parameters.h +++ b/PowerEditor/src/Parameters.h @@ -1615,6 +1615,14 @@ public: return _userPath; } + generic_string getUserDefineLangFolderPath() const { + return _userDefineLangsFolderPath; + } + + generic_string getUserDefineLangPath() const { + return _userDefineLangPath; + } + bool writeSettingsFilesOnCloudForThe1stTime(const generic_string & cloudSettingsPath); void setCloudChoice(const TCHAR *pathChoice); void removeCloudChoice(); @@ -1698,6 +1706,7 @@ private: UserLangContainer *_userLangArray[NB_MAX_USER_LANG]; unsigned char _nbUserLang = 0; // won't be exceeded to 255; + generic_string _userDefineLangsFolderPath; generic_string _userDefineLangPath; ExternalLangContainer *_externalLangArray[NB_MAX_EXTERNAL_LANG]; int _nbExternalLang = 0; diff --git a/PowerEditor/src/localization.cpp b/PowerEditor/src/localization.cpp index 2446e63f7..01cb181c0 100644 --- a/PowerEditor/src/localization.cpp +++ b/PowerEditor/src/localization.cpp @@ -36,9 +36,9 @@ using namespace std; MenuPosition menuPos[] = { - //============================================== - // {L0, L1, L2, id}, - //============================================== +//============================================== +// {L0, L1, L2, id}, +//============================================== { 0, -1, -1, "file" }, { 1, -1, -1, "edit" }, { 2, -1, -1, "search" }, @@ -98,6 +98,8 @@ MenuPosition menuPos[] = { { 4, 5, 14, "encoding-westernEuropean" }, { 4, 5, 15, "encoding-vietnamese" }, + { 5, 23, -1, "language-userDefinedLanguage" }, + { 6, 4, -1, "settings-import" }, { 7, 0, -1, "tools-md5" },