0

coral: UI strings

This cl adds and adjusts the strings in coral and enables translation.

Bug: b:388047163, b:385204376, b:385203508, b:385203922
Change-Id: I35bffecb63330a967531dd176107841720b76998
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6174302
Commit-Queue: Xiaodan Zhu <zxdan@chromium.org>
Reviewed-by: Xiaoqian Dai <xdai@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1406856}
This commit is contained in:
Xiaodan Zhu
2025-01-15 11:26:03 -08:00
committed by Chromium LUCI CQ
parent 97d423f0ee
commit 9fdd76995b
22 changed files with 68 additions and 34 deletions

@@ -8914,49 +8914,55 @@ To shut down the device, press and hold the power button on the device again.
Send feedback Send feedback
</message> </message>
<message name="IDS_ASH_BIRCH_CORAL_USER_FEEDBACK_DESCRIPTION" desc="The description for the user feedback UI"> <message name="IDS_ASH_BIRCH_CORAL_USER_FEEDBACK_DESCRIPTION" desc="The description for the user feedback UI">
This is experimental AI feature and won't always get it right. Generative AI can make mistakes, including about people, so double-check it.
</message> </message>
<message name="IDS_ASH_BIRCH_CORAL_THUMB_UP_ACCESSIBLE_NAME" desc="The accessible name for the thumb up button which is in the user feedback UI"> <message name="IDS_ASH_BIRCH_CORAL_THUMB_UP_ACCESSIBLE_NAME" desc="The accessible name for the thumb up button which is in the user feedback UI">
Thumbs up would submit the feedback that you like this suggestion Thumbs up would submit the feedback that you like this suggested group
</message> </message>
<message name="IDS_ASH_BIRCH_CORAL_THUMB_DOWN_ACCESSIBLE_NAME" desc="The accessible name for the thumb down button which is in the user feedback UI"> <message name="IDS_ASH_BIRCH_CORAL_THUMB_DOWN_ACCESSIBLE_NAME" desc="The accessible name for the thumb down button which is in the user feedback UI">
Thumbs down would submit the feedback that you dislike this suggestion Thumbs down would submit the feedback that you dislike this suggested group
</message> </message>
<message name="IDS_ASH_BIRCH_CORAL_SELECTOR_TAB_SUBTITLE" translateable="false" desc="In the birch coral button selector UI, the subtitle for the tab section."> <message name="IDS_ASH_BIRCH_CORAL_SELECTOR_TAB_SUBTITLE" desc="In the birch coral button selector UI, the subtitle for the tab section.">
Tabs Tabs
</message> </message>
<message name="IDS_ASH_BIRCH_CORAL_SELECTOR_APP_SUBTITLE" translateable="false" desc="In the birch coral button selector UI, the subtitle for the app section."> <message name="IDS_ASH_BIRCH_CORAL_SELECTOR_APP_SUBTITLE" desc="In the birch coral button selector UI, the subtitle for the app section.">
Apps Apps
</message> </message>
<message name="IDS_ASH_BIRCH_CORAL_SELECTOR_ACCESSIBLE_NAME" translateable="false" desc="The accessible name for the birch coral button selector UI."> <message name="IDS_ASH_BIRCH_CORAL_SELECTOR_ACCESSIBLE_NAME" translateable="false" desc="The accessible name for the birch coral button selector UI.">
Coral selector Coral selector
</message> </message>
<message name="IDS_ASH_BIRCH_CORAL_ADDON_SELECTOR_SHOWN" translateable="false" desc="The accessible name for the birch coral button selector UI."> <message name="IDS_ASH_BIRCH_CORAL_SELECTOR_ITEM_CLOSE_BUTTON_TOOLTIP" desc="The tooltip of the close button on smart grouping expanded menu item">
Hide Remove item from suggested group
</message> </message>
<message name="IDS_ASH_BIRCH_CORAL_ADDON_SELECTOR_HIDDEN" translateable="false" desc="The accessible name for the birch coral button selector UI."> <message name="IDS_ASH_BIRCH_CORAL_ADDON_SELECTOR_SHOWN" desc="The accessible name for the birch coral button selector UI.">
Show Hide items in <ph name="GROUP_NAME">$1<ex>Trip To Tokyo</ex></ph>
</message> </message>
<message name="IDS_ASH_BIRCH_CORAL_SAVED_GROUPS_MAX_NUM_REACHED" translateable="false" desc="Message shown to users when they attempt to save a new coral group when the maximum number of coral saved groups has been reached."> <message name="IDS_ASH_BIRCH_CORAL_ADDON_SELECTOR_HIDDEN" desc="The accessible name for the birch coral button selector UI.">
Show items in <ph name="GROUP_NAME">$1<ex>Trip To Tokyo</ex></ph>
</message>
<message name="IDS_ASH_BIRCH_CORAL_SAVED_GROUPS_MAX_NUM_REACHED" desc="Message shown to users when they attempt to save a new coral group when the maximum number of coral saved groups has been reached.">
Maximum number of saved groups reached. Maximum number of saved groups reached.
</message> </message>
<message name="IDS_ASH_BIRCH_CORAL_SUGGESTION_NAME" translateable="false" desc="The general name of the suggestions provided by coral service"> <message name="IDS_ASH_BIRCH_CORAL_SUGGESTION_NAME" desc="The general name of the suggestions provided by coral service">
Suggested group Suggested group
</message> </message>
<message name="IDS_ASH_BIRCH_CORAL_RESTORE_CHIP_SUBTITLE" translateable="false" desc="The subtitle of coral restore chip"> <message name="IDS_ASH_BIRCH_CORAL_BAR_MENU_ITEM" desc="The name of smart grouping service in Glanceables bar context menu item">
App &amp; tab groups
</message>
<message name="IDS_ASH_BIRCH_CORAL_RESTORE_CHIP_SUBTITLE" desc="The subtitle of coral restore chip">
Resume suggested group Resume suggested group
</message> </message>
<message name="IDS_ASH_BIRCH_CORAL_IN_SESSION_CHIP_SUBTITLE" translateable="false" desc="The subtitle of coral in-session chip"> <message name="IDS_ASH_BIRCH_CORAL_IN_SESSION_CHIP_SUBTITLE" desc="The subtitle of coral in-session chip">
Organize in a new desk Organize in a new desk
</message> </message>
<message name="IDS_ASH_BIRCH_CORAL_CHIP_MENU_OPEN_GROUP" translateable="false" desc="The chip menu item label of opening a group"> <message name="IDS_ASH_BIRCH_CORAL_CHIP_MENU_OPEN_GROUP" desc="The chip menu item label of opening a group">
Open Open
</message> </message>
<message name="IDS_ASH_BIRCH_CORAL_CHIP_MENU_SAVE_GROUP" translateable="false" desc="The chip menu item label of saving a group as a desk template"> <message name="IDS_ASH_BIRCH_CORAL_CHIP_MENU_SAVE_GROUP" desc="The chip menu item label of saving a group as a desk template">
Save group for later Save group for later
</message> </message>
<message name="IDS_ASH_BIRCH_CORAL_CHIP_MENU_HIDE_GROUP" translateable="false" desc="The chip menu item label of hiding a group"> <message name="IDS_ASH_BIRCH_CORAL_CHIP_MENU_HIDE_GROUP" desc="The chip menu item label of hiding a group">
Don't suggest group to resume Hide all group suggestions
</message> </message>
<!-- Graduation app strings --> <!-- Graduation app strings -->

@@ -0,0 +1 @@
c6b19b1b7272cc99cd524075c199bcc177687805

@@ -0,0 +1 @@
4452ec06f5beeef8a3ba63cf67148a6706d71824

@@ -0,0 +1 @@
3641b6c3adf2080bbae81c5169415ea80b0933de

@@ -0,0 +1 @@
8eb227932e7be7255e892362120780fd69f19a40

@@ -0,0 +1 @@
484df2250fef8478165c72d35db1a5db4256e39b

@@ -0,0 +1 @@
c912d9c009fd4191e0d2994b5d7e1398f1a004bf

@@ -0,0 +1 @@
80f297b2f8852f3588708b2af8c2c437f369f83d

@@ -0,0 +1 @@
cfda07f88936e67ee7604aa14213ebc103ffa964

@@ -0,0 +1 @@
96256db40407f7fe70d628458b65e98e3f9d7206

@@ -0,0 +1 @@
6c236b1d4435ad7cb5c40c8059f9f314b0f0751b

@@ -0,0 +1 @@
fe70ea4754613d681b8f76a35a4b7a12f1e07fec

@@ -0,0 +1 @@
cc2de5f56bdfc52dc29391e523302c9503d49a63

@@ -0,0 +1 @@
1b091fdf481e4252f58722a6b31708f2ea47ee72

@@ -1 +1 @@
f8b50f6daaaa17bf2a7901d9cfcb3da9254dd8f2 a914cb84f571a250c74cdf11cefc4300975ac116

@@ -1 +1 @@
8521f9623603df153d263e1251abbe23f5975eaf 4f88593c4dafff32d0db5e419f52456b713ed8ea

@@ -1 +1 @@
2e33d4b3415dd5a6e010afb7aa21ecfd83e5c09f 481126150cf7fdb142203625bd8c0c8d693542fb

@@ -40,7 +40,7 @@ BirchBarContextMenuModel::BirchBarContextMenuModel(
if (features::IsCoralFeatureEnabled()) { if (features::IsCoralFeatureEnabled()) {
AddItem(base::to_underlying(CommandId::kCoralSuggestions), AddItem(base::to_underlying(CommandId::kCoralSuggestions),
l10n_util::GetStringUTF16(IDS_ASH_BIRCH_CORAL_SUGGESTION_NAME)); l10n_util::GetStringUTF16(IDS_ASH_BIRCH_CORAL_BAR_MENU_ITEM));
} }
bool enabled = IsWeatherAllowedByGeolocation(); bool enabled = IsWeatherAllowedByGeolocation();

@@ -42,15 +42,7 @@ CoralChipButton::~CoralChipButton() = default;
void CoralChipButton::OnSelectionWidgetVisibilityChanged() { void CoralChipButton::OnSelectionWidgetVisibilityChanged() {
CHECK(tab_app_selection_widget_); CHECK(tab_app_selection_widget_);
UpdateRoundedCorners(tab_app_selection_widget_->IsVisible()); UpdateRoundedCorners(tab_app_selection_widget_->IsVisible());
UpdateAddonButtonTooltip();
views::View* chevron_button = addon_view();
CHECK(chevron_button);
views::AsViewClass<IconButton>(chevron_button)
->SetTooltipText(l10n_util::GetStringUTF16(
tab_app_selection_widget_->IsVisible()
? IDS_ASH_BIRCH_CORAL_ADDON_SELECTOR_SHOWN
: IDS_ASH_BIRCH_CORAL_ADDON_SELECTOR_HIDDEN));
} }
void CoralChipButton::ShutdownSelectionWidget() { void CoralChipButton::ShutdownSelectionWidget() {
@@ -85,6 +77,10 @@ void CoralChipButton::UpdateTitle(
} }
SetAccessibleName(item_->GetAccessibleName()); SetAccessibleName(item_->GetAccessibleName());
if (chevron_button_) {
UpdateAddonButtonTooltip();
}
} }
void CoralChipButton::Init(BirchItem* item) { void CoralChipButton::Init(BirchItem* item) {
@@ -114,9 +110,11 @@ void CoralChipButton::Init(BirchItem* item) {
auto button = birch_bar_util::CreateCoralAddonButton( auto button = birch_bar_util::CreateCoralAddonButton(
std::move(callback), vector_icons::kCaretUpIcon); std::move(callback), vector_icons::kCaretUpIcon);
button->SetTooltipText( button->SetTooltipText(l10n_util::GetStringFUTF16(
l10n_util::GetStringUTF16(IDS_ASH_BIRCH_CORAL_ADDON_SELECTOR_HIDDEN)); IDS_ASH_BIRCH_CORAL_ADDON_SELECTOR_HIDDEN, item_->title()));
chevron_button_ = button.get();
SetAddon(std::move(button)); SetAddon(std::move(button));
UpdateAddonButtonTooltip();
} }
void CoralChipButton::ExecuteCommand(int command_id, int event_flags) { void CoralChipButton::ExecuteCommand(int command_id, int event_flags) {
@@ -232,6 +230,15 @@ void CoralChipButton::DestroyBorderAnimation() {
} }
} }
void CoralChipButton::UpdateAddonButtonTooltip() {
CHECK(chevron_button_);
chevron_button_->SetTooltipText(l10n_util::GetStringFUTF16(
tab_app_selection_widget_ && tab_app_selection_widget_->IsVisible()
? IDS_ASH_BIRCH_CORAL_ADDON_SELECTOR_SHOWN
: IDS_ASH_BIRCH_CORAL_ADDON_SELECTOR_HIDDEN,
item_->title()));
}
BEGIN_METADATA(CoralChipButton) BEGIN_METADATA(CoralChipButton)
END_METADATA END_METADATA

@@ -62,6 +62,10 @@ class ASH_EXPORT CoralChipButton : public BirchChipButton {
// Destroys `rainbow_border_animated_image_`. // Destroys `rainbow_border_animated_image_`.
void DestroyBorderAnimation(); void DestroyBorderAnimation();
// Updates the add-on chevron button's tooltip according to current selector
// menu state and group title.
void UpdateAddonButtonTooltip();
raw_ptr<views::AnimatedImageView> title_loading_animated_image_ = nullptr; raw_ptr<views::AnimatedImageView> title_loading_animated_image_ = nullptr;
raw_ptr<views::AnimatedImageView> rainbow_border_animated_image_ = nullptr; raw_ptr<views::AnimatedImageView> rainbow_border_animated_image_ = nullptr;
@@ -71,6 +75,8 @@ class ASH_EXPORT CoralChipButton : public BirchChipButton {
// once the coral add on button is clicked. // once the coral add on button is clicked.
std::unique_ptr<TabAppSelectionHost> tab_app_selection_widget_; std::unique_ptr<TabAppSelectionHost> tab_app_selection_widget_;
raw_ptr<Button> chevron_button_ = nullptr;
base::WeakPtrFactory<CoralChipButton> weak_factory_{this}; base::WeakPtrFactory<CoralChipButton> weak_factory_{this};
}; };

@@ -140,7 +140,7 @@ class TabAppSelectionView::TabAppSelectionItemView
owner_(params.owner) { owner_(params.owner) {
views::Builder<views::BoxLayoutView>(this) views::Builder<views::BoxLayoutView>(this)
.SetAccessibleRole(ax::mojom::Role::kMenuItem) .SetAccessibleRole(ax::mojom::Role::kMenuItem)
.SetAccessibleName(u"TempAccessibleName") .SetAccessibleName(base::UTF8ToUTF16(params.title))
.SetBetweenChildSpacing(kItemChildSpacing) .SetBetweenChildSpacing(kItemChildSpacing)
.SetCrossAxisAlignment(views::LayoutAlignment::kCenter) .SetCrossAxisAlignment(views::LayoutAlignment::kCenter)
.SetFocusBehavior(views::View::FocusBehavior::ACCESSIBLE_ONLY) .SetFocusBehavior(views::View::FocusBehavior::ACCESSIBLE_ONLY)
@@ -180,6 +180,8 @@ class TabAppSelectionView::TabAppSelectionItemView
close_button_->layer()->SetOpacity(0.f); close_button_->layer()->SetOpacity(0.f);
close_button_->SetEnabled(false); close_button_->SetEnabled(false);
close_button_->SetID(TabAppSelectionView::kCloseButtonID); close_button_->SetID(TabAppSelectionView::kCloseButtonID);
close_button_->SetTooltipText(l10n_util::GetStringUTF16(
IDS_ASH_BIRCH_CORAL_SELECTOR_ITEM_CLOSE_BUTTON_TOOLTIP));
} }
auto* delegate = Shell::Get()->saved_desk_delegate(); auto* delegate = Shell::Get()->saved_desk_delegate();

@@ -68,7 +68,7 @@ TEST_F(CoralPixelDiffTest, CoralSelectorView) {
TabAppSelectionHost* menu = ShowAndGetSelectorMenu(GetEventGenerator()); TabAppSelectionHost* menu = ShowAndGetSelectorMenu(GetEventGenerator());
EXPECT_TRUE(GetPixelDiffer()->CompareUiComponentsOnPrimaryScreen( EXPECT_TRUE(GetPixelDiffer()->CompareUiComponentsOnPrimaryScreen(
"coral_selector_view", /*revision_number=*/3, menu)); "coral_selector_view", /*revision_number=*/4, menu));
} }
} // namespace ash } // namespace ash