desk_profiles: Update chromevox strings for desk button
This updates the chromevox strings for the desk button. It also cleans up unused strings and fixes the wrong string for the desk switch button. Bug: N/A Test: Manual Change-Id: Id7f99b4867210a34be7de74f6fc3bb4246de751f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5266102 Reviewed-by: Daniel Andersson <dandersson@chromium.org> Commit-Queue: Yongshun Liu <yongshun@chromium.org> Cr-Commit-Position: refs/heads/main@{#1256554}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
56e15be848
commit
9034bd0356
ash
ash_strings.grd
ash_strings_grd
IDS_SHELF_DESK_BUTTON_TITLE.png.sha1IDS_SHELF_DESK_BUTTON_TITLE_NO_PROFILE_AVATAR.png.sha1IDS_SHELF_DESK_BUTTON_TITLE_WITH_PROFILE_AVATAR.png.sha1IDS_SHELF_NEXT_DESK_BUTTON_TITLE.png.sha1IDS_SHELF_NEXT_DESK_BUTTON_TITLE_16_DESKS.png.sha1IDS_SHELF_PREVIOUS_DESK_BUTTON_TITLE.png.sha1IDS_SHELF_PREVIOUS_DESK_BUTTON_TITLE_16_DESKS.png.sha1
wm
desks
@ -278,19 +278,16 @@ Style notes:
|
||||
See all apps
|
||||
</message>
|
||||
<message name="IDS_SHELF_PREVIOUS_DESK_BUTTON_TITLE" desc="The title used for the previous desk button within the desk button on the shelf.">
|
||||
Previous Desk: <ph name="PREVIOUS_DESK_NAME">$1<ex>Desk 1</ex></ph>, use Search+Space or keyboard shortcut: Shift+Search+<ph name="PREVIOUS_DESK_INDEX">$2<ex>1</ex></ph> to activate.
|
||||
Previous desk: <ph name="DESK_NAME">$1<ex>Desk 1</ex></ph>. Desk <ph name="DESK_INDEX">$2<ex>1</ex></ph> of <ph name="DESK_COUNT">$3<ex>3</ex></ph>.
|
||||
</message>
|
||||
<message name="IDS_SHELF_PREVIOUS_DESK_BUTTON_TITLE_16_DESKS" desc="The title used for the previous desk button within the desk button on the shelf when that desk is beyond the 8th desk.">
|
||||
Previous Desk: <ph name="PREVIOUS_DESK_NAME">$1<ex>Desk 12</ex></ph>, use Search+Space to activate.
|
||||
<message name="IDS_SHELF_DESK_BUTTON_TITLE_NO_PROFILE_AVATAR" desc="The title used for the desk button on the shelf with no profile avatar.">
|
||||
Current desk: <ph name="DESK_NAME">$1<ex>Desk 2</ex></ph>. Desk <ph name="DESK_INDEX">$2<ex>2</ex></ph> of <ph name="DESK_COUNT">$3<ex>3</ex></ph>.
|
||||
</message>
|
||||
<message name="IDS_SHELF_DESK_BUTTON_TITLE" desc="The title used for the desk button on the shelf.">
|
||||
Current Desk: <ph name="CURRENT_DESK_NAME">$1<ex>Desk 2</ex></ph>, use Search+Space to open all desks menu.
|
||||
<message name="IDS_SHELF_DESK_BUTTON_TITLE_WITH_PROFILE_AVATAR" desc="The title used for the desk button on the shelf with profile avatar.">
|
||||
Current desk: <ph name="DESK_NAME">$1<ex>Desk 2</ex></ph>. <ph name="PROFILE_NAME">$2<ex>Profile name</ex></ph> <ph name="EMAIL">$3<ex>test@gmail.com</ex></ph>. Desk <ph name="DESK_INDEX">$4<ex>2</ex></ph> of <ph name="DESK_COUNT">$5<ex>3</ex></ph>.
|
||||
</message>
|
||||
<message name="IDS_SHELF_NEXT_DESK_BUTTON_TITLE" desc="The title used for the next desk button within the desk button on the shelf.">
|
||||
Next Desk: <ph name="NEXT_DESK_NAME">$1<ex>Desk 3</ex></ph>, use Search+Space or keyboard shortcut: Shift+Search+<ph name="NEXT_DESK_INDEX">$2<ex>3</ex></ph> to activate.
|
||||
</message>
|
||||
<message name="IDS_SHELF_NEXT_DESK_BUTTON_TITLE_16_DESKS" desc="The title used for the next desk button within the desk button on the shelf when that desk is beyond the 8th desk.">
|
||||
Next Desk: <ph name="NEXT_DESK_NAME">$1<ex>Desk 14</ex></ph>, use Search+Space to activate.
|
||||
Next desk: <ph name="DESK_NAME">$1<ex>Desk 3</ex></ph>. Desk <ph name="DESK_INDEX">$2<ex>3</ex></ph> of <ph name="DESK_COUNT">$3<ex>3</ex></ph>.
|
||||
</message>
|
||||
|
||||
|
||||
|
@ -1 +0,0 @@
|
||||
7cd27ea32853e41b4398004fe2dfa2d9939b438b
|
@ -0,0 +1 @@
|
||||
e11263d96d7a2201c608351f82f98f789eb19cb9
|
@ -0,0 +1 @@
|
||||
b95106681e23a17ad249ae6d4fb1973d24cc8056
|
@ -1 +1 @@
|
||||
9779b0564eaba7361dd7f0f33e7300437224bc3f
|
||||
a96e8db5db570e9c0920f90852c908e0c3ab2481
|
@ -1 +0,0 @@
|
||||
fccfc6a0870cc6a6621843b07bd187d30836816f
|
@ -1 +1 @@
|
||||
e98b80cc9d6aa1c9da35e3d6535f88625b81b071
|
||||
ac20b85cac695c02f3e8b9b5f71c9afabdae2245
|
@ -1 +0,0 @@
|
||||
400267ebd23a9cd1c926baa225b8ce6406f968e2
|
@ -237,8 +237,6 @@ void DeskButton::Init(DeskButtonContainer* desk_button_container) {
|
||||
TypographyProvider::Get()->StyleLabel(TypographyToken::kCrosButton2,
|
||||
*desk_name_label_);
|
||||
|
||||
UpdateLocaleSpecificSettings();
|
||||
|
||||
// Use shelf view as the context menu controller so that it shows the same
|
||||
// context menu.
|
||||
set_context_menu_controller(
|
||||
@ -273,8 +271,8 @@ std::u16string DeskButton::GetTitle() const {
|
||||
}
|
||||
|
||||
void DeskButton::UpdateUi(const Desk* active_desk) {
|
||||
desk_name_label_->SetText(GetDeskNameLabelText(active_desk));
|
||||
UpdateAvatar(active_desk);
|
||||
UpdateLocaleSpecificSettings();
|
||||
}
|
||||
|
||||
void DeskButton::UpdateAvatar(const Desk* active_desk) {
|
||||
@ -289,6 +287,7 @@ void DeskButton::UpdateAvatar(const Desk* active_desk) {
|
||||
if (auto* summary =
|
||||
desk_profiles_delegate->GetProfilesSnapshotByProfileId(
|
||||
active_desk->lacros_profile_id())) {
|
||||
profile_ = *summary;
|
||||
desk_avatar_image_ = gfx::ImageSkiaOperations::CreateResizedImage(
|
||||
summary->icon, skia::ImageOperations::RESIZE_BEST,
|
||||
kDeskButtonAvatarSize);
|
||||
@ -305,9 +304,23 @@ void DeskButton::UpdateAvatar(const Desk* active_desk) {
|
||||
}
|
||||
|
||||
void DeskButton::UpdateLocaleSpecificSettings() {
|
||||
const Desk* active_desk = DesksController::Get()->active_desk();
|
||||
SetAccessibleName(l10n_util::GetStringFUTF16(IDS_SHELF_DESK_BUTTON_TITLE,
|
||||
active_desk->name()));
|
||||
// Update the accessible name.
|
||||
DesksController* desk_controller = DesksController::Get();
|
||||
const Desk* active_desk = desk_controller->active_desk();
|
||||
if (desk_avatar_view_ && desk_avatar_view_->GetVisible()) {
|
||||
SetAccessibleName(l10n_util::GetStringFUTF16(
|
||||
IDS_SHELF_DESK_BUTTON_TITLE_WITH_PROFILE_AVATAR, active_desk->name(),
|
||||
base::UTF8ToUTF16(profile_.name), base::UTF8ToUTF16(profile_.email),
|
||||
base::NumberToString16(desk_controller->GetDeskIndex(active_desk) + 1),
|
||||
base::NumberToString16(desk_controller->GetNumberOfDesks())));
|
||||
} else {
|
||||
SetAccessibleName(l10n_util::GetStringFUTF16(
|
||||
IDS_SHELF_DESK_BUTTON_TITLE_NO_PROFILE_AVATAR, active_desk->name(),
|
||||
base::NumberToString16(desk_controller->GetDeskIndex(active_desk) + 1),
|
||||
base::NumberToString16(desk_controller->GetNumberOfDesks())));
|
||||
}
|
||||
|
||||
// Update the button text since the default desk name can be locale specific.
|
||||
desk_name_label_->SetText(GetDeskNameLabelText(active_desk));
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <string>
|
||||
|
||||
#include "ash/ash_export.h"
|
||||
#include "ash/public/cpp/desk_profiles_delegate.h"
|
||||
#include "ash/shelf/shelf.h"
|
||||
#include "ui/base/metadata/metadata_header_macros.h"
|
||||
#include "ui/gfx/geometry/size.h"
|
||||
@ -98,6 +99,10 @@ class ASH_EXPORT DeskButton : public views::Button {
|
||||
// Image for the profile avatar.
|
||||
gfx::ImageSkia desk_avatar_image_;
|
||||
|
||||
// Profile summary of the desk's associated profile. It's cached during
|
||||
// `UpdateAvatar()`.
|
||||
LacrosProfileSummary profile_;
|
||||
|
||||
// A label that displays the active desk's name.
|
||||
raw_ptr<views::Label> desk_name_label_;
|
||||
|
||||
|
@ -104,8 +104,6 @@ void DeskSwitchButton::Init(DeskButtonContainer* desk_button_container,
|
||||
this, gfx::Insets(kDeskButtonSwitchButtonFocusRingHaloInset),
|
||||
kDeskButtonCornerRadius);
|
||||
|
||||
UpdateLocaleSpecificSettings();
|
||||
|
||||
// Use shelf view as the context menu controller so that it shows the same
|
||||
// context menu.
|
||||
set_context_menu_controller(
|
||||
@ -145,18 +143,22 @@ void DeskSwitchButton::UpdateUi(const Desk* active_desk) {
|
||||
// normal, e.g. right clicks on the button.
|
||||
SetBackgroundVisible(GetEnabled() && IsMouseHovered() &&
|
||||
GetState() == ButtonState::STATE_HOVERED);
|
||||
|
||||
UpdateLocaleSpecificSettings();
|
||||
}
|
||||
|
||||
void DeskSwitchButton::UpdateLocaleSpecificSettings() {
|
||||
const auto* desk_controller = DesksController::Get();
|
||||
const Desk* active_desk = desk_controller->active_desk();
|
||||
const int index = desk_controller->GetDeskIndex(active_desk) +
|
||||
(type_ == Type::kPrev ? -1 : 1);
|
||||
const int id = type_ == Type::kPrev ? IDS_SHELF_PREVIOUS_DESK_BUTTON_TITLE
|
||||
: IDS_SHELF_NEXT_DESK_BUTTON_TITLE;
|
||||
if (index >= 0 && index < desk_controller->GetNumberOfDesks()) {
|
||||
const int target_index =
|
||||
desk_controller->GetActiveDeskIndex() + (type_ == Type::kPrev ? -1 : 1);
|
||||
const int desk_count = desk_controller->GetNumberOfDesks();
|
||||
if (target_index >= 0 && target_index < desk_count) {
|
||||
const Desk* target_desk = desk_controller->GetDeskAtIndex(target_index);
|
||||
const int id = type_ == Type::kPrev ? IDS_SHELF_PREVIOUS_DESK_BUTTON_TITLE
|
||||
: IDS_SHELF_NEXT_DESK_BUTTON_TITLE;
|
||||
SetAccessibleName(l10n_util::GetStringFUTF16(
|
||||
id, active_desk->name(), base::NumberToString16(index + 1)));
|
||||
id, target_desk->name(), base::NumberToString16(target_index + 1),
|
||||
base::NumberToString16(desk_count)));
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user