mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 19:57:57 +01:00
runner: localize tray menu item labels (#7959)
* runner: localize tray menu item labels * fixup: please the electronic machinery * Update src/runner/Resources.resx Co-authored-by: Enrico Giordani <enricogior@users.noreply.github.com> Co-authored-by: Enrico Giordani <enricogior@users.noreply.github.com>
This commit is contained in:
2
.github/actions/spell-check/expect.txt
vendored
2
.github/actions/spell-check/expect.txt
vendored
@@ -1338,6 +1338,8 @@ memset
|
|||||||
Mensching
|
Mensching
|
||||||
MENUITEMINFO
|
MENUITEMINFO
|
||||||
menurc
|
menurc
|
||||||
|
menuitem
|
||||||
|
MENUITEMINFOW
|
||||||
MENUSTART
|
MENUSTART
|
||||||
messagebox
|
messagebox
|
||||||
METACHARSET
|
METACHARSET
|
||||||
|
|||||||
@@ -154,4 +154,11 @@
|
|||||||
<data name="SNOOZE_BUTTON" xml:space="preserve">
|
<data name="SNOOZE_BUTTON" xml:space="preserve">
|
||||||
<value>Snooze</value>
|
<value>Snooze</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="SETTINGS_MENU_TEXT" xml:space="preserve">
|
||||||
|
<value>Settings</value>
|
||||||
|
</data>
|
||||||
|
<data name="EXIT_MENU_TEXT" xml:space="preserve">
|
||||||
|
<value>Exit</value>
|
||||||
|
<comment>Exit as a verb, as in Exit the application</comment>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -49,6 +49,14 @@ bool dispatch_run_on_main_ui_thread(main_loop_callback_function _callback, PVOID
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void change_menu_item_text(const UINT item_id, wchar_t* new_text)
|
||||||
|
{
|
||||||
|
MENUITEMINFOW menuitem = { .cbSize = sizeof(MENUITEMINFOW), .fMask = MIIM_TYPE | MIIM_DATA };
|
||||||
|
GetMenuItemInfoW(h_menu, item_id, false, &menuitem);
|
||||||
|
menuitem.dwTypeData = new_text;
|
||||||
|
SetMenuItemInfoW(h_menu, item_id, false, &menuitem);
|
||||||
|
}
|
||||||
|
|
||||||
LRESULT __stdcall tray_icon_window_proc(HWND window, UINT message, WPARAM wparam, LPARAM lparam)
|
LRESULT __stdcall tray_icon_window_proc(HWND window, UINT message, WPARAM wparam, LPARAM lparam)
|
||||||
{
|
{
|
||||||
switch (message)
|
switch (message)
|
||||||
@@ -125,6 +133,13 @@ LRESULT __stdcall tray_icon_window_proc(HWND window, UINT message, WPARAM wparam
|
|||||||
{
|
{
|
||||||
h_menu = LoadMenu(reinterpret_cast<HINSTANCE>(&__ImageBase), MAKEINTRESOURCE(ID_TRAY_MENU));
|
h_menu = LoadMenu(reinterpret_cast<HINSTANCE>(&__ImageBase), MAKEINTRESOURCE(ID_TRAY_MENU));
|
||||||
}
|
}
|
||||||
|
if (h_menu)
|
||||||
|
{
|
||||||
|
static std::wstring settings_menuitem_label = GET_RESOURCE_STRING(IDS_SETTINGS_MENU_TEXT);
|
||||||
|
static std::wstring exit_menuitem_label = GET_RESOURCE_STRING(IDS_EXIT_MENU_TEXT);
|
||||||
|
change_menu_item_text(ID_SETTINGS_MENU_COMMAND, settings_menuitem_label.data());
|
||||||
|
change_menu_item_text(ID_EXIT_MENU_COMMAND, exit_menuitem_label.data());
|
||||||
|
}
|
||||||
if (!h_sub_menu)
|
if (!h_sub_menu)
|
||||||
{
|
{
|
||||||
h_sub_menu = GetSubMenu(h_menu, 0);
|
h_sub_menu = GetSubMenu(h_menu, 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user