Merge pull request #1106 from alekhyareddy28/locPowerRename

Localize PowerRename
This commit is contained in:
Alekhya 2020-01-20 12:11:07 -08:00 committed by GitHub
commit ba1a681aab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 42 additions and 18 deletions

View File

@ -77,4 +77,4 @@ std::wstring get_resource_string(UINT resource_id, HINSTANCE instance, const wch
// Requires that
// extern "C" IMAGE_DOS_HEADER __ImageBase;
// is added to the .cpp file.
#define GET_RESOURCE_STRING(resource_id) get_resource_string(resource_id, reinterpret_cast<HINSTANCE>(&__ImageBase), L#resource_id)
#define GET_RESOURCE_STRING(resource_id) get_resource_string(resource_id, reinterpret_cast<HINSTANCE>(&__ImageBase), L#resource_id)

View File

@ -4,6 +4,7 @@
#include <PowerRenameItem.h>
#include <PowerRenameManager.h>
#include <trace.h>
#include <common.h>
#include <Helpers.h>
#include <icon_helpers.h>
#include <Settings.h>
@ -20,6 +21,7 @@ struct InvokeStruct
CPowerRenameMenu::CPowerRenameMenu()
{
ModuleAddRef();
app_name = GET_RESOURCE_STRING(IDS_POWERRENAME);
}
CPowerRenameMenu::~CPowerRenameMenu()
@ -196,7 +198,7 @@ DWORD WINAPI CPowerRenameMenu::s_PowerRenameUIThreadProc(_In_ void* pData)
HRESULT __stdcall CPowerRenameMenu::GetTitle(IShellItemArray* /*psiItemArray*/, LPWSTR* ppszName)
{
return SHStrDup(L"PowerRename", ppszName);
return SHStrDup(app_name.c_str(), ppszName);
}
HRESULT __stdcall CPowerRenameMenu::GetIcon(IShellItemArray* /*psiItemArray*/, LPWSTR* ppszIcon)

View File

@ -71,4 +71,5 @@ private:
std::atomic<long> m_refCount = 1;
HBITMAP m_hbmpIcon = nullptr;
CComPtr<IDataObject> m_spdo;
std::wstring app_name;
};

View File

@ -91,7 +91,14 @@
STRINGTABLE
BEGIN
IDS_POWERRENAME "PowerRename"
IDS_POWERRENAME "PowerRename"
IDS_SETTINGS_DESCRIPTION L"A Windows Shell Extension for more advanced bulk renaming using search and replace or regular expressions."
IDS_OVERVIEW_LINK L"https://github.com/microsoft/PowerToys/tree/master/src/modules/powerrename"
IDS_RESTORE_SEARCH L"Restore search, replace and flags values on launch from previous run."
IDS_ENABLE_AUTO L"Enable autocomplete and autosuggest of recently used inputs for search and replace values."
IDS_MAX_ITEMS L"Maximum number of items to show in recently used list for autocomplete dropdown."
IDS_ICON_CONTEXT_MENU L"Show icon on context menu."
IDS_EXTENDED_MENU_INFO L"Only show the PowerRename menu item on the extended context menu (Shift + Right-click)."
END
#endif // English (United States) resources

View File

@ -4,7 +4,8 @@
#include <settings.h>
#include <trace.h>
#include <common/settings_objects.h>
#include <common/common.h>
#include "resource.h"
#include <atomic>
std::atomic<DWORD> g_dwModuleRefCount = 0;
@ -160,12 +161,13 @@ class PowerRenameModule : public PowertoyModuleIface
private:
// Enabled by default
bool m_enabled = true;
std::wstring app_name;
public:
// Return the display name of the powertoy, this will be cached
virtual PCWSTR get_name() override
{
return L"PowerRename";
return app_name.c_str();
}
// Enable the powertoy
@ -203,25 +205,25 @@ public:
// Create a Settings object.
PowerToysSettings::Settings settings(hinstance, get_name());
settings.set_description(L"A Windows Shell Extension for more advanced bulk renaming using search and replace or regular expressions.");
settings.set_description(GET_RESOURCE_STRING(IDS_SETTINGS_DESCRIPTION));
settings.set_icon_key(L"pt-power-rename");
// Link to the GitHub PowerRename sub-page
settings.set_overview_link(L"https://github.com/microsoft/PowerToys/tree/master/src/modules/powerrename");
settings.set_overview_link(GET_RESOURCE_STRING(IDS_OVERVIEW_LINK));
settings.add_bool_toogle(
L"bool_persist_input",
L"Restore search, replace and flags values on launch from previous run.",
GET_RESOURCE_STRING(IDS_RESTORE_SEARCH),
CSettings::GetPersistState());
settings.add_bool_toogle(
L"bool_mru_enabled",
L"Enable autocomplete and autosuggest of recently used inputs for search and replace values.",
GET_RESOURCE_STRING(IDS_ENABLE_AUTO),
CSettings::GetMRUEnabled());
settings.add_int_spinner(
L"int_max_mru_size",
L"Maximum number of items to show in recently used list for autocomplete dropdown.",
GET_RESOURCE_STRING(IDS_MAX_ITEMS),
CSettings::GetMaxMRUSize(),
0,
20,
@ -229,12 +231,12 @@ public:
settings.add_bool_toogle(
L"bool_show_icon_on_menu",
L"Show icon on context menu.",
GET_RESOURCE_STRING(IDS_ICON_CONTEXT_MENU),
CSettings::GetShowIconOnMenu());
settings.add_bool_toogle(
L"bool_show_extended_menu",
L"Only show the PowerRename menu item on the extended context menu (SHIFT + Right-click).",
GET_RESOURCE_STRING(IDS_EXTENDED_MENU_INFO),
CSettings::GetExtendedContextMenuOnly());
return settings.serialize_to_buffer(buffer, buffer_size);
@ -298,7 +300,10 @@ public:
PowerRenameModule()
{
init_settings();
app_name = GET_RESOURCE_STRING(IDS_POWERRENAME);
}
~PowerRenameModule(){};
};
extern "C" __declspec(dllexport) PowertoyModuleIface* __cdecl powertoy_create()

View File

@ -1,13 +1,22 @@
#define IDS_POWERRENAME 801
#define IDI_RENAME 132
#define IDS_SETTINGS_DESCRIPTION 2101
#define IDS_OVERVIEW_LINK 2102
#define IDS_RESTORE_SEARCH 2103
#define IDS_ENABLE_AUTO 2104
#define IDS_MAX_ITEMS 2105
#define IDS_ICON_CONTEXT_MENU 2106
#define IDS_EXTENDED_MENU_INFO 2107
// Next default values for new objects
//
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 102
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#define _APS_NEXT_RESOURCE_VALUE 102
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@ -1,4 +1,3 @@
#include "stdafx.h"
#include <commctrl.h>
#include "Settings.h"

View File

@ -8,6 +8,7 @@
#include <PowerRenameUI.h>
#include <PowerRenameManager.h>
#include <Shobjidl.h>
#include <common.h>
#pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")