From 9537dd793df64129a3548c8ee76d7576378a2892 Mon Sep 17 00:00:00 2001 From: Alekhya Reddy Kommuru Date: Mon, 16 Mar 2020 08:34:26 -0700 Subject: [PATCH] Localized the strings of Launcher --- src/modules/launcher/Wox.Launcher/Wox.Launcher.rc | 10 +++++++++- src/modules/launcher/Wox.Launcher/dllmain.cpp | 13 +++++++------ src/modules/launcher/Wox.Launcher/pch.cpp | 3 ++- src/modules/launcher/Wox.Launcher/pch.h | 3 ++- src/modules/launcher/Wox.Launcher/resource.h | 2 ++ 5 files changed, 22 insertions(+), 9 deletions(-) diff --git a/src/modules/launcher/Wox.Launcher/Wox.Launcher.rc b/src/modules/launcher/Wox.Launcher/Wox.Launcher.rc index c85d6bb9a..ceb12a24d 100644 --- a/src/modules/launcher/Wox.Launcher/Wox.Launcher.rc +++ b/src/modules/launcher/Wox.Launcher/Wox.Launcher.rc @@ -1,4 +1,12 @@ -ÿþ1 VERSIONINFO +ÿþ#include "resource.h" + +STRINGTABLE +BEGIN + IDS_LAUNCHER_NAME L"Launcher" + IDS_LAUNCHER_SETTINGS_DESC L"<No description>" +END + +1 VERSIONINFO FILEVERSION 0,1,0,0 PRODUCTVERSION 0,1,0,0 FILEFLAGSMASK 0x3fL diff --git a/src/modules/launcher/Wox.Launcher/dllmain.cpp b/src/modules/launcher/Wox.Launcher/dllmain.cpp index 4b9374f3a..68efd29d0 100644 --- a/src/modules/launcher/Wox.Launcher/dllmain.cpp +++ b/src/modules/launcher/Wox.Launcher/dllmain.cpp @@ -4,6 +4,7 @@ #include #include #include "trace.h" +#include "resource.h" extern "C" IMAGE_DOS_HEADER __ImageBase; @@ -22,10 +23,6 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReser return TRUE; } -// The PowerToy name that will be shown in the settings. -const static wchar_t* MODULE_NAME = L"Launcher"; -// Add a description that will we shown in the module settings page. -const static wchar_t* MODULE_DESC = L""; // These are the properties shown in the Settings page. struct ModuleSettings { @@ -54,9 +51,13 @@ private: // Handle to launch and terminate the launcher HANDLE m_hProcess; + //contains the name of the powerToys + std::wstring app_name; + public: // Constructor Wox_Launcher() { + app_name = GET_RESOURCE_STRING(IDS_LAUNCHER_NAME); init_settings(); }; @@ -67,7 +68,7 @@ public: // Return the display name of the powertoy, this will be cached by the runner virtual const wchar_t* get_name() override { - return MODULE_NAME; + return app_name.c_str(); } // Return array of the names of all events that this powertoy listens for, with @@ -92,7 +93,7 @@ public: // Create a Settings object. PowerToysSettings::Settings settings(hinstance, get_name()); - settings.set_description(MODULE_DESC); + settings.set_description(GET_RESOURCE_STRING(IDS_LAUNCHER_SETTINGS_DESC)); // Show an overview link in the Settings page //settings.set_overview_link(L"https://"); diff --git a/src/modules/launcher/Wox.Launcher/pch.cpp b/src/modules/launcher/Wox.Launcher/pch.cpp index a83d3bb2c..a3d1ff422 100644 --- a/src/modules/launcher/Wox.Launcher/pch.cpp +++ b/src/modules/launcher/Wox.Launcher/pch.cpp @@ -1,2 +1,3 @@ #include "pch.h" -#pragma comment(lib, "windowsapp") \ No newline at end of file +#pragma comment(lib, "windowsapp") +#pragma comment(lib, "shlwapi.lib") \ No newline at end of file diff --git a/src/modules/launcher/Wox.Launcher/pch.h b/src/modules/launcher/Wox.Launcher/pch.h index 8fca88842..8cb4314b9 100644 --- a/src/modules/launcher/Wox.Launcher/pch.h +++ b/src/modules/launcher/Wox.Launcher/pch.h @@ -3,4 +3,5 @@ #include #include #include -#include \ No newline at end of file +#include +#include \ No newline at end of file diff --git a/src/modules/launcher/Wox.Launcher/resource.h b/src/modules/launcher/Wox.Launcher/resource.h index e69de29bb..aad6c4bbd 100644 --- a/src/modules/launcher/Wox.Launcher/resource.h +++ b/src/modules/launcher/Wox.Launcher/resource.h @@ -0,0 +1,2 @@ +#define IDS_LAUNCHER_NAME 601 +#define IDS_LAUNCHER_SETTINGS_DESC 602