0

customization: Translate strings for customizable button names

screenshot: http://screen/3a4C4Ytrk85hKQA

Bug: b/286930911
Change-Id: I65be62951dd3b3f462ab1cb83661a12d8563dd0a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5208222
Commit-Queue: Danny Wang <wangdanny@google.com>
Reviewed-by: David Padlipsky <dpad@google.com>
Cr-Commit-Position: refs/heads/main@{#1248895}
This commit is contained in:
Danny Wang
2024-01-18 18:15:17 +00:00
committed by Chromium LUCI CQ
parent f6fb40f730
commit 501e5e49bb
5 changed files with 28 additions and 8 deletions

@ -7434,9 +7434,18 @@ To shut down the device, press and hold the power button on the device again.
<message name="IDS_ASH_DEVICE_SETTINGS_LEARN_MORE_BUTTON" desc="Button shown for device settings notifications which opens an article with helpful information related to the notification.">
Learn more
</message>
<message name="IDS_SETTINGS_CUSTOMIZATION_BACK_BUTTON_DEFAULT_NAME" desc="The name of the back mouse button on a mouse">
Back Button
</message>
<message name="IDS_SETTINGS_CUSTOMIZATION_FORWARD_BUTTON_DEFAULT_NAME" desc="The name of the forward mouse button on a mouse">
Forward Button
</message>
<message name="IDS_SETTINGS_CUSTOMIZATION_MIDDLE_BUTTON_DEFAULT_NAME" desc="The name of the middle mouse button on a mouse">
Middle Button
</message>
<message name="IDS_SETTINGS_CUSTOMIZATION_SIDE_BUTTON_DEFAULT_NAME" desc="The name of the side mouse button on a mouse">
Side Button
</message>
<message name="IDS_SETTINGS_CUSTOMIZATION_OTHER_BUTTON_DEFAULT_NAME" desc="The default name to give additional buttons on a mouse or graphics tablet">
Other Button <ph name="BUTTON_NUMBER">$1<ex>1</ex></ph>
</message>

@ -0,0 +1 @@
957b9b9946bf7b0b64afbe718a780f46c445ed7c

@ -0,0 +1 @@
957b9b9946bf7b0b64afbe718a780f46c445ed7c

@ -0,0 +1 @@
957b9b9946bf7b0b64afbe718a780f46c445ed7c

@ -5,8 +5,10 @@
#include "ash/system/input_device_settings/input_device_settings_metadata.h"
#include "ash/public/mojom/input_device_settings.mojom.h"
#include "ash/strings/grit/ash_strings.h"
#include "ash/system/input_device_settings/input_device_settings_utils.h"
#include "base/no_destructor.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/events/devices/input_device.h"
#include "ui/events/devices/keyboard_device.h"
@ -259,21 +261,23 @@ std::vector<mojom::ButtonRemappingPtr> GetDefaultButtonRemappingList() {
return {};
}
// TODO(dpad, b/286930911): Translate button names
std::vector<mojom::ButtonRemappingPtr> GetFiveKeyButtonRemappingList() {
std::vector<mojom::ButtonRemappingPtr> array;
array.push_back(mojom::ButtonRemapping::New(
/*name=*/"Middle button",
/*name=*/l10n_util::GetStringUTF8(
IDS_SETTINGS_CUSTOMIZATION_MIDDLE_BUTTON_DEFAULT_NAME),
/*button=*/
mojom::Button::NewCustomizableButton(mojom::CustomizableButton::kMiddle),
/*remapping_action=*/nullptr));
array.push_back(mojom::ButtonRemapping::New(
/*name=*/"Forward button",
/*name=*/l10n_util::GetStringUTF8(
IDS_SETTINGS_CUSTOMIZATION_FORWARD_BUTTON_DEFAULT_NAME),
/*button=*/
mojom::Button::NewCustomizableButton(mojom::CustomizableButton::kExtra),
/*remapping_action=*/nullptr));
array.push_back(mojom::ButtonRemapping::New(
/*name=*/"Back button",
/*name=*/l10n_util::GetStringUTF8(
IDS_SETTINGS_CUSTOMIZATION_BACK_BUTTON_DEFAULT_NAME),
/*button=*/
mojom::Button::NewCustomizableButton(mojom::CustomizableButton::kSide),
/*remapping_action=*/nullptr));
@ -283,22 +287,26 @@ std::vector<mojom::ButtonRemappingPtr> GetFiveKeyButtonRemappingList() {
std::vector<mojom::ButtonRemappingPtr> GetLogitechSixKeyButtonRemappingList() {
std::vector<mojom::ButtonRemappingPtr> array;
array.push_back(mojom::ButtonRemapping::New(
/*name=*/"Middle button",
/*name=*/l10n_util::GetStringUTF8(
IDS_SETTINGS_CUSTOMIZATION_MIDDLE_BUTTON_DEFAULT_NAME),
/*button=*/
mojom::Button::NewCustomizableButton(mojom::CustomizableButton::kMiddle),
/*remapping_action=*/nullptr));
array.push_back(mojom::ButtonRemapping::New(
/*name=*/"Forward button",
/*name=*/l10n_util::GetStringUTF8(
IDS_SETTINGS_CUSTOMIZATION_FORWARD_BUTTON_DEFAULT_NAME),
/*button=*/
mojom::Button::NewCustomizableButton(mojom::CustomizableButton::kExtra),
/*remapping_action=*/nullptr));
array.push_back(mojom::ButtonRemapping::New(
/*name=*/"Back button",
/*name=*/l10n_util::GetStringUTF8(
IDS_SETTINGS_CUSTOMIZATION_BACK_BUTTON_DEFAULT_NAME),
/*button=*/
mojom::Button::NewCustomizableButton(mojom::CustomizableButton::kSide),
/*remapping_action=*/nullptr));
array.push_back(mojom::ButtonRemapping::New(
/*name=*/"Side button",
/*name=*/l10n_util::GetStringUTF8(
IDS_SETTINGS_CUSTOMIZATION_SIDE_BUTTON_DEFAULT_NAME),
/*button=*/
mojom::Button::NewCustomizableButton(mojom::CustomizableButton::kForward),
/*remapping_action=*/nullptr));