0

Move modifier split internal strings to public

Screenshot:
https://screenshot.googleplex.com/LZrHPKem7nsRhCk
https://screenshot.googleplex.com/BmW2By3wLwACf5w
https://screenshot.googleplex.com/BEDheS6viKbJoxL
https://screenshot.googleplex.com/9y7PLZ5bggUKvpf

Bug: b:339279922
Change-Id: If0825720b8a1d8e0238d120ea67df44073ffa322
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5958335
Reviewed-by: Michael Cui <mlcui@google.com>
Reviewed-by: Michael Checo <michaelcheco@google.com>
Reviewed-by: Xiangdong Kong <xiangdongkong@google.com>
Reviewed-by: David Padlipsky <dpad@google.com>
Commit-Queue: Yuhan Yang <yyhyyh@google.com>
Cr-Commit-Position: refs/heads/main@{#1375012}
This commit is contained in:
YuhanYang
2024-10-29 01:43:16 +00:00
committed by Chromium LUCI CQ
parent ada61d4499
commit 78c04d86cf
16 changed files with 27 additions and 68 deletions

@ -3751,8 +3751,8 @@ No devices connected.
<message name="IDS_ASH_STATUS_TRAY_CAPS_LOCK_CANCEL_BY_SEARCH" desc="The message shown on a bubble when caps lock is turned on.">
Press Search or Shift to cancel.
</message>
<message name="IDS_ASH_STATUS_TRAY_CAPS_LOCK_CANCEL_BY_FN_SEARCH" desc="The message shown on a bubble when caps lock is turned on.">
Press Fn+Search or Shift to cancel.
<message name="IDS_ASH_STATUS_TRAY_CAPS_LOCK_CANCEL_BY_FN_QUICK_INSERT" desc="The message shown on a bubble when caps lock is turned on.">
Press fn + Quick Insert or Shift to cancel.
</message>
<message name="IDS_ASH_STATUS_TRAY_BUBBLE_SESSION_LENGTH_LIMIT" desc="Tray bubble item shown to inform the user that the session length is limited.">
Session ends in <ph name="session_time_remaining">$1<ex>4 minutes 23 seconds</ex></ph>.
@ -4342,9 +4342,8 @@ No devices connected.
<message name="IDS_ASH_ACCELERATOR_DESCRIPTION_SHOW_EMOJI_PICKER" desc="Label for accelerator action - Open Emoji Picker.">
Open Emoji Picker
</message>
<!-- TODO(b/286268215): Translate this string -->
<message name="IDS_ASH_ACCELERATOR_DESCRIPTION_SHOW_PICKER" translateable="false" desc="Label for accelerator action - Open Picker.">
Open Picker
<message name="IDS_ASH_ACCELERATOR_DESCRIPTION_QUICK_INSERT" desc="Label for accelerator action - Right alt.">
Quick Insert
</message>
<message name="IDS_ASH_ACCELERATOR_DESCRIPTION_STOP_SCREEN_RECORDING" desc="Label for accelerator action - Stop screen recording.">
Stop screen recording

@ -0,0 +1 @@
c8c708e2bba86d0257d3f2800c93670c291cf078

@ -0,0 +1 @@
2cddc2447936c54594d3387a4a83c04dcddf3313

@ -1 +0,0 @@
d552a2d54a59b8aa5b0be7234f6626413e423422

@ -13,6 +13,7 @@
#include "ash/style/typography.h"
#include "base/strings/strcat.h"
#include "build/branding_buildflags.h"
#include "chromeos/strings/grit/chromeos_strings.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/base/models/image_model.h"
@ -25,7 +26,6 @@
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
#include "chromeos/ash/resources/internal/icons/vector_icons.h"
#include "chromeos/ash/resources/internal/strings/grit/ash_internal_strings.h"
#endif // BUILDFLAG(GOOGLE_CHROME_BRANDING)
namespace ash {
@ -88,7 +88,7 @@ PickerShortcutHintView::PickerShortcutHintView(
kShortcutIconSize)));
shortcut_text_ = base::StrCat(
{fn_label->GetText(), plus_label->GetText(),
l10n_util::GetStringUTF16(IDS_KEYBOARD_RIGHT_ALT_LABEL)});
l10n_util::GetStringUTF16(IDS_KEYBOARD_QUICK_INSERT_LABEL)});
#endif // BUILDFLAG(GOOGLE_CHROME_BRANDING)
break;
}

@ -29,10 +29,6 @@
#include "ui/message_center/message_center.h"
#include "ui/message_center/public/cpp/notification.h"
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
#include "chromeos/ash/resources/internal/strings/grit/ash_internal_strings.h"
#endif // BUILDFLAG(GOOGLE_CHROME_BRANDING)
using message_center::MessageCenter;
using message_center::Notification;
using SystemTrayButtonSize = ash::UnifiedSystemTrayModel::SystemTrayButtonSize;
@ -61,11 +57,7 @@ int GetMessageStringId() {
if (base::ranges::find(keyboard->modifier_keys,
ui::mojom::ModifierKey::kFunction) !=
keyboard->modifier_keys.end()) {
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
return IDS_ASH_STATUS_TRAY_CAPS_LOCK_CANCEL_BY_FN;
#else
return IDS_ASH_STATUS_TRAY_CAPS_LOCK_CANCEL_BY_FN_SEARCH;
#endif // BUILDFLAG(GOOGLE_CHROME_BRANDING)
return IDS_ASH_STATUS_TRAY_CAPS_LOCK_CANCEL_BY_FN_QUICK_INSERT;
}
// If the search key is remapped to kCapsLock, return search key message id.

@ -12,10 +12,6 @@
#include "ui/base/webui/web_ui_util.h"
#include "ui/events/ash/keyboard_capability.h"
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
#include "chromeos/ash/resources/internal/strings/grit/ash_internal_strings.h"
#endif // BUILDFLAG(GOOGLE_CHROME_BRANDING)
namespace ash {
namespace common {
@ -102,18 +98,13 @@ void AddShortcutInputKeyStrings(content::WebUIDataSource* html_source) {
{"inputKeyPlaceholder", IDS_SHORTCUT_CUSTOMIZATION_INPUT_KEY_PLACEHOLDER},
};
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
if (Shell::Get()->keyboard_capability()->IsModifierSplitEnabled()) {
html_source->AddLocalizedString("iconLabelRightAlt",
IDS_KEYBOARD_RIGHT_ALT_LABEL);
IDS_KEYBOARD_QUICK_INSERT_LABEL);
} else {
html_source->AddLocalizedString(
"iconLabelRightAlt", IDS_SHORTCUT_CUSTOMIZATION_INPUT_KEY_PLACEHOLDER);
}
#else
html_source->AddLocalizedString(
"iconLabelRightAlt", IDS_SHORTCUT_CUSTOMIZATION_INPUT_KEY_PLACEHOLDER);
#endif
html_source->AddLocalizedStrings(kLocalizedStrings);
html_source->UseStringsJs();

@ -609,12 +609,6 @@ AcceleratorConfigurationProvider::AcceleratorConfigurationProvider(
continue;
}
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
if (layout_id == AcceleratorAction::kTogglePicker &&
Shell::Get()->keyboard_capability()->IsModifierSplitEnabled()) {
layout->description_string_id = IDS_ASH_ACCELERATOR_DESCRIPTION_RIGHT_ALT;
}
#endif // BUILDFLAG(GOOGLE_CHROME_BRANDING)
layout_infos_.push_back(LayoutInfoToMojom(*layout));
accelerator_layout_lookup_[GetUuid(layout->source, layout->action_id)] =
*layout;

@ -1392,7 +1392,7 @@ const AcceleratorLayoutMap& GetAcceleratorLayoutMap() {
mojom::AcceleratorSource::kAsh)},
{AcceleratorAction::kTogglePicker,
AcceleratorLayoutDetails(AcceleratorAction::kTogglePicker,
IDS_ASH_ACCELERATOR_DESCRIPTION_SHOW_PICKER,
IDS_ASH_ACCELERATOR_DESCRIPTION_QUICK_INSERT,
mojom::AcceleratorCategory::kText,
mojom::AcceleratorSubcategory::kTextEditing,
/*locked=*/false,

@ -40,10 +40,6 @@
#include "ui/webui/color_change_listener/color_change_handler.h"
#include "ui/webui/mojo_web_ui_controller.h"
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
#include "chromeos/ash/resources/internal/strings/grit/ash_internal_strings.h"
#endif // BUILDFLAG(GOOGLE_CHROME_BRANDING)
namespace ash {
namespace {
@ -250,26 +246,20 @@ void AddLocalizedStrings(content::WebUIDataSource* source) {
IDS_SHORTCUT_CUSTOMIZATION_ICON_LABEL_ZOOM_TOGGLE},
};
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
// For official builds, only add the real string if the feature is enabled.
if (Shell::Get()->keyboard_capability()->IsModifierSplitEnabled()) {
source->AddLocalizedString(
"blockRightAltKey",
IDS_SHORTCUT_CUSTOMIZATION_BLOCK_RIGHT_ALT_KEY_ERROR_MESSAGE);
IDS_SHORTCUT_CUSTOMIZATION_BLOCK_QUICK_INSERT_KEY_ERROR_MESSAGE);
source->AddLocalizedString("iconLabelRightAlt",
IDS_KEYBOARD_RIGHT_ALT_LABEL);
IDS_KEYBOARD_QUICK_INSERT_LABEL);
} else {
source->AddLocalizedString("blockRightAltKey",
IDS_SHORTCUT_CUSTOMIZATION_BLOCK_RIGHT_ALT_KEY);
source->AddLocalizedString(
"iconLabelRightAlt", IDS_SHORTCUT_CUSTOMIZATION_INPUT_KEY_PLACEHOLDER);
}
#else
source->AddLocalizedString("blockRightAltKey",
IDS_SHORTCUT_CUSTOMIZATION_BLOCK_RIGHT_ALT_KEY);
source->AddLocalizedString("iconLabelRightAlt",
IDS_SHORTCUT_CUSTOMIZATION_INPUT_KEY_PLACEHOLDER);
#endif
source->AddLocalizedStrings(kLocalizedStrings);
source->AddString("shortcutCustomizationLearnMoreUrl",
kShortcutCustomizationLearnMoreURL);

@ -38,10 +38,6 @@
#include "ui/events/ash/keyboard_capability.h"
#include "ui/events/keycodes/keyboard_codes_posix.h"
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
#include "chromeos/ash/resources/internal/strings/grit/ash_internal_strings.h"
#endif // BUILDFLAG(GOOGLE_CHROME_BRANDING)
namespace app_list {
namespace {
@ -145,11 +141,7 @@ std::optional<int> GetStringIdForIconCode(IconCode icon_code) {
case ash::SearchResultTextItem::kKeyboardShortcutAccessibility:
return IDS_SHORTCUT_CUSTOMIZATION_ICON_LABEL_ACCESSIBILITY;
case ash::SearchResultTextItem::kKeyboardShortcutKeyboardRightAlt:
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
return IDS_KEYBOARD_RIGHT_ALT_LABEL;
#else
return IDS_SHORTCUT_CUSTOMIZATION_INPUT_KEY_PLACEHOLDER;
#endif
return IDS_KEYBOARD_QUICK_INSERT_LABEL;
}
}

@ -59,6 +59,7 @@ static_library("device") {
"//chrome/common:chrome_features",
"//chromeos/components/magic_boost/public/cpp",
"//chromeos/constants",
"//chromeos/strings",
"//components/spellcheck/browser",
"//components/user_manager",
"//content/public/browser",

@ -32,6 +32,7 @@
#include "chrome/common/webui_url_constants.h"
#include "chrome/grit/generated_resources.h"
#include "chromeos/constants/chromeos_features.h"
#include "chromeos/strings/grit/chromeos_strings.h"
#include "components/user_manager/user_manager.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_data_source.h"
@ -45,10 +46,6 @@
#include "ui/events/ash/keyboard_layout_util.h"
#include "ui/events/devices/device_data_manager.h"
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
#include "chromeos/ash/resources/internal/strings/grit/ash_internal_strings.h"
#endif // BUILDFLAG(GOOGLE_CHROME_BRANDING)
namespace ash::settings {
namespace mojom {
@ -872,21 +869,14 @@ void AddDeviceKeyboardStrings(content::WebUIDataSource* html_source) {
};
html_source->AddLocalizedStrings(keyboard_strings);
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
// For official builds, only add the real string if the feature is enabled.
if (Shell::Get()->keyboard_capability()->IsModifierSplitEnabled()) {
html_source->AddLocalizedString("perDeviceKeyboardKeyRightAlt",
IDS_KEYBOARD_RIGHT_ALT_LABEL);
IDS_KEYBOARD_QUICK_INSERT_LABEL);
} else {
html_source->AddLocalizedString(
"perDeviceKeyboardKeyRightAlt",
IDS_SETTINGS_PER_DEVICE_KEYBOARD_KEY_RIGHT_ALT);
}
#else
html_source->AddLocalizedString(
"perDeviceKeyboardKeyRightAlt",
IDS_SETTINGS_PER_DEVICE_KEYBOARD_KEY_RIGHT_ALT);
#endif
html_source->AddBoolean(
"enableModifierSplit",

@ -6136,6 +6136,10 @@
that includes right alt key." translateable="false">
Press a new shortcut without right alt.
</message>
<message name="IDS_SHORTCUT_CUSTOMIZATION_BLOCK_QUICK_INSERT_KEY_ERROR_MESSAGE" desc="The status message that displays when user press a key combination
that includes right alt key.">
Quick Insert can't be used for custom shortcuts.
</message>
<message name="IDS_SHORTCUT_CUSTOMIZATION_SEACH_WITH_FUNCTION_KEY_NOT_ALLOWED_STATUS_MESSAGE"
desc="The status message that displays when user press a key combination
that includes the search/launcher key with a function key.">
@ -6170,6 +6174,9 @@
user is required to press a key combination for a shortcut.">
key
</message>
<message name="IDS_KEYBOARD_QUICK_INSERT_LABEL" desc="In keyboard subpage, the item for the super insert key.">
quick insert
</message>
<message name="IDS_SHORTCUT_CUSTOMIZATION_ACCELERATOR_TEXT_DIVIDER" desc="The text shown between multiple shortcut keys.">
or
</message>

@ -0,0 +1 @@
a472e224e8b4d13b7244b6b8df687446ffb51c32

@ -0,0 +1 @@
86f868e314ae1aeefdc88157d5fd4493d53ecc99