Commit 175dcf7b authored by Yue Li's avatar Yue Li Committed by Commit Bot

Quick Answers: Move A11y strings into grd file

Bug: b/149758492
Test: Manual Test
Change-Id: Ibcb69b07c79cbb365d81f5ce1f2ba34861eb6dcd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2512522Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Yue Li <updowndota@chromium.org>
Cr-Commit-Position: refs/heads/master@{#823334}
parent 5a6cc97e
...@@ -2879,6 +2879,18 @@ Here are some things you can try to get started. ...@@ -2879,6 +2879,18 @@ Here are some things you can try to get started.
<message name="IDS_ASH_QUICK_ANSWERS_USER_NOTICE_VIEW_ACCEPT_BUTTON" desc="Display text on the accept button in the dialog that opens up to seek user-consent for the Quick Answers feature."> <message name="IDS_ASH_QUICK_ANSWERS_USER_NOTICE_VIEW_ACCEPT_BUTTON" desc="Display text on the accept button in the dialog that opens up to seek user-consent for the Quick Answers feature.">
Got it Got it
</message> </message>
<message name="IDS_ASH_QUICK_ANSWERS_USER_NOTICE_VIEW_A11Y_SETTINGS_BUTTON_DESC_TEXT" desc="A11y description text for the settings button in Quick Answers user notice view.">
Click to open Google Assistant settings.
</message>
<message name="IDS_ASH_QUICK_ANSWERS_USER_NOTICE_VIEW_A11Y_ACCEPT_BUTTON_DESC_TEXT" desc="A11y description text for the accept button in Quick Answers user notice view.">
Let Assistant show info such as definition, translation or unit conversion for your selection.
</message>
<message name="IDS_ASH_QUICK_ANSWERS_USER_NOTICE_VIEW_A11Y_INFO_ALERT_TEXT" desc="A11y alert text for the Quick Answers user notice view.">
New feature available, use Up arrow key to learn more.
</message>
<message name="IDS_ASH_QUICK_ANSWERS_USER_NOTICE_VIEW_A11Y_INFO_DESC_TEMPLATE" desc="A11y description template for the Quick Answers user notice view.">
<ph name="DESC_TEXT">$1<ex>With a right-click or a long press, Assistant shows info such as the definition, translation or unit conversion for your selection.</ex></ph> Use Left or Right arrow keys to manage this feature.
</message>
<!-- Media Notification --> <!-- Media Notification -->
<message name="IDS_ASH_MEDIA_NOTIFICATION_ACTION_PREVIOUS_TRACK" desc="The button to trigger media playback to go to the previous track."> <message name="IDS_ASH_MEDIA_NOTIFICATION_ACTION_PREVIOUS_TRACK" desc="The button to trigger media playback to go to the previous track.">
......
7e35db9b65d6a47aa8e6988437ae9827595ae13d
\ No newline at end of file
aab060fce65a6061d5deb326da713efb76c6f13a
\ No newline at end of file
1f862235742af0c00bf26ec2ede783eeb7d141a0
\ No newline at end of file
3a6ce7cb0ff2178eccac2ec5b451e7c508428b11
\ No newline at end of file
...@@ -62,27 +62,15 @@ constexpr int kButtonFontSizeDelta = 1; ...@@ -62,27 +62,15 @@ constexpr int kButtonFontSizeDelta = 1;
// Manage-Settings button. // Manage-Settings button.
constexpr SkColor kSettingsButtonTextColor = gfx::kGoogleBlue600; constexpr SkColor kSettingsButtonTextColor = gfx::kGoogleBlue600;
constexpr char kA11ySettingsButtonDescText[] =
"Click to open Google Assistant settings.";
// Accept button. // Accept button.
constexpr SkColor kAcceptButtonTextColor = gfx::kGoogleGrey200; constexpr SkColor kAcceptButtonTextColor = gfx::kGoogleGrey200;
constexpr char kA11yAcceptButtonDescText[] =
"Let Assistant show info such as definition, translation or unit "
"conversion for your selection.";
// Dogfood button. // Dogfood button.
constexpr int kDogfoodButtonMarginDip = 4; constexpr int kDogfoodButtonMarginDip = 4;
constexpr int kDogfoodButtonSizeDip = 20; constexpr int kDogfoodButtonSizeDip = 20;
constexpr SkColor kDogfoodButtonColor = gfx::kGoogleGrey500; constexpr SkColor kDogfoodButtonColor = gfx::kGoogleGrey500;
// Accessibility.
// TODO(siabhijeet): Move to grd after finalizing with UX.
constexpr char kA11yInfoAlertText[] =
"New feature available, use Up arrow key to learn more.";
constexpr char kA11yInfoDescTemplate[] =
"%s Use Left or Right arrow keys to manage this feature.";
// Create and return a simple label with provided specs. // Create and return a simple label with provided specs.
std::unique_ptr<views::Label> CreateLabel(const base::string16& text, std::unique_ptr<views::Label> CreateLabel(const base::string16& text,
const SkColor color, const SkColor color,
...@@ -161,7 +149,8 @@ UserNoticeView::UserNoticeView(const gfx::Rect& anchor_view_bounds, ...@@ -161,7 +149,8 @@ UserNoticeView::UserNoticeView(const gfx::Rect& anchor_view_bounds,
reinterpret_cast<void*>(views::MenuConfig::kMenuControllerGroupingId)); reinterpret_cast<void*>(views::MenuConfig::kMenuControllerGroupingId));
// Read out user-consent notice if screen-reader is active. // Read out user-consent notice if screen-reader is active.
GetViewAccessibility().AnnounceText(base::UTF8ToUTF16(kA11yInfoAlertText)); GetViewAccessibility().AnnounceText(l10n_util::GetStringUTF16(
IDS_ASH_QUICK_ANSWERS_USER_NOTICE_VIEW_A11Y_INFO_ALERT_TEXT));
} }
UserNoticeView::~UserNoticeView() = default; UserNoticeView::~UserNoticeView() = default;
...@@ -193,10 +182,10 @@ views::FocusTraversable* UserNoticeView::GetPaneFocusTraversable() { ...@@ -193,10 +182,10 @@ views::FocusTraversable* UserNoticeView::GetPaneFocusTraversable() {
void UserNoticeView::GetAccessibleNodeData(ui::AXNodeData* node_data) { void UserNoticeView::GetAccessibleNodeData(ui::AXNodeData* node_data) {
node_data->role = ax::mojom::Role::kDialog; node_data->role = ax::mojom::Role::kDialog;
node_data->SetName(title_); node_data->SetName(title_);
auto desc = base::StringPrintf( auto desc = l10n_util::GetStringFUTF8(
kA11yInfoDescTemplate, IDS_ASH_QUICK_ANSWERS_USER_NOTICE_VIEW_A11Y_INFO_DESC_TEMPLATE,
l10n_util::GetStringUTF8(IDS_ASH_QUICK_ANSWERS_USER_NOTICE_VIEW_DESC_TEXT) l10n_util::GetStringUTF16(
.c_str()); IDS_ASH_QUICK_ANSWERS_USER_NOTICE_VIEW_DESC_TEXT));
node_data->SetDescription(desc); node_data->SetDescription(desc);
} }
...@@ -316,7 +305,8 @@ void UserNoticeView::InitButtonBar() { ...@@ -316,7 +305,8 @@ void UserNoticeView::InitButtonBar() {
IDS_ASH_QUICK_ANSWERS_USER_NOTICE_VIEW_MANAGE_SETTINGS_BUTTON), IDS_ASH_QUICK_ANSWERS_USER_NOTICE_VIEW_MANAGE_SETTINGS_BUTTON),
kSettingsButtonTextColor); kSettingsButtonTextColor);
settings_button->GetViewAccessibility().OverrideDescription( settings_button->GetViewAccessibility().OverrideDescription(
kA11ySettingsButtonDescText); l10n_util::GetStringUTF16(
IDS_ASH_QUICK_ANSWERS_USER_NOTICE_VIEW_A11Y_SETTINGS_BUTTON_DESC_TEXT));
settings_button_ = button_bar->AddChildView(std::move(settings_button)); settings_button_ = button_bar->AddChildView(std::move(settings_button));
auto accept_button = std::make_unique<CustomizedLabelButton>( auto accept_button = std::make_unique<CustomizedLabelButton>(
...@@ -326,7 +316,8 @@ void UserNoticeView::InitButtonBar() { ...@@ -326,7 +316,8 @@ void UserNoticeView::InitButtonBar() {
kAcceptButtonTextColor); kAcceptButtonTextColor);
accept_button->SetProminent(true); accept_button->SetProminent(true);
accept_button->GetViewAccessibility().OverrideDescription( accept_button->GetViewAccessibility().OverrideDescription(
kA11yAcceptButtonDescText); l10n_util::GetStringUTF16(
IDS_ASH_QUICK_ANSWERS_USER_NOTICE_VIEW_A11Y_ACCEPT_BUTTON_DESC_TEXT));
accept_button_ = button_bar->AddChildView(std::move(accept_button)); accept_button_ = button_bar->AddChildView(std::move(accept_button));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment