0

assistant: Add strings for the shift to Launcher

Bug: b/312245149
Test: Checked manually
Change-Id: Ia5ece03604fe270ee6118ef278d3c57fff1b8244
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5117057
Commit-Queue: Tao Wu <wutao@chromium.org>
Reviewed-by: Yuki Awano <yawano@google.com>
Cr-Commit-Position: refs/heads/main@{#1237218}
This commit is contained in:
Tao Wu
2023-12-13 22:16:27 +00:00
committed by Chromium LUCI CQ
parent ec10b3dabb
commit 20a1b792cb
11 changed files with 56 additions and 22 deletions

@ -5559,6 +5559,33 @@ Some features are limited to increase battery life.
I'm your Google Assistant, here to help you throughout your day! I'm your Google Assistant, here to help you throughout your day!
Here are some things you can try to get started. Here are some things you can try to get started.
</message> </message>
<message name="IDS_ASH_ASSISTANT_LAUNCHER_SEARCH_IPH_CHIP_WEATHER" desc="Message shown on suggestion chip in LauncherSearchIphView to initiate a query." meaning="Query text on the button. [CHAR_LIMIT=14]">
Weather
</message>
<message name="IDS_ASH_ASSISTANT_LAUNCHER_SEARCH_IPH_CHIP_UNIT_CONVERSION1" desc="Message shown on suggestion chip in LauncherSearchIphView to initiate a query." meaning="Query text on the button. [CHAR_LIMIT=14]">
5 ft in m
</message>
<message name="IDS_ASH_ASSISTANT_LAUNCHER_SEARCH_IPH_CHIP_UNIT_CONVERSION2" desc="Message shown on suggestion chip in LauncherSearchIphView to initiate a query." meaning="Query text on the button. [CHAR_LIMIT=14]">
90°F in C
</message>
<message name="IDS_ASH_ASSISTANT_LAUNCHER_SEARCH_IPH_CHIP_TRANSLATION" desc="Message shown on suggestion chip in LauncherSearchIphView to initiate a query." meaning="Query text on the button. [CHAR_LIMIT=14]">
Hi in French
</message>
<message name="IDS_ASH_ASSISTANT_LAUNCHER_SEARCH_IPH_CHIP_DEFINITION" desc="Message shown on suggestion chip in LauncherSearchIphView to initiate a query." meaning="Query text on the button. [CHAR_LIMIT=14]">
Define zenith
</message>
<message name="IDS_ASH_ASSISTANT_LAUNCHER_SEARCH_IPH_CHIP_CALCULATION" desc="Message shown on suggestion chip in LauncherSearchIphView to initiate a query." meaning="Query text on the button. [CHAR_LIMIT=14]">
50+94/5
</message>
<message name="IDS_ASH_ASSISTANT_LAUNCHER_SEARCH_IPH_CHIP_ASSISTANT" desc="Message shown on suggestion chip in LauncherSearchIphView to open the Assistant UI." meaning="Text on the button. [CHAR_LIMIT=14]">
Go to Assistant
</message>
<message name="IDS_ASH_ASSISTANT_LAUNCHER_SEARCH_IPH_TITLE" desc="Text shown in LauncherSearchIphView.">
Search for what you need directly in Launcher
</message>
<message name="IDS_ASH_ASSISTANT_LAUNCHER_SEARCH_IPH_DESCRIPTION" desc="Description shown in LauncherSearchIphView.">
Here are a few suggestions to try
</message>
<!-- For ScreenCaptureTrayItemView --> <!-- For ScreenCaptureTrayItemView -->
<message name="IDS_ASH_ADMIN_SCREEN_CAPTURE" desc="Tooltip message shown at the systray screen capture indicator when an administrator is capturing the screens."> <message name="IDS_ASH_ADMIN_SCREEN_CAPTURE" desc="Tooltip message shown at the systray screen capture indicator when an administrator is capturing the screens.">

@ -0,0 +1 @@
87edc42001f4f36f3b3d15c48e42d99d3a431df0

@ -0,0 +1 @@
40300726574a32056d0d7bbbaf642a9e73962a9a

@ -0,0 +1 @@
40300726574a32056d0d7bbbaf642a9e73962a9a

@ -0,0 +1 @@
ebbc77dbd1fd39bc2f92e397ddd58083a6fe9646

@ -0,0 +1 @@
ebbc77dbd1fd39bc2f92e397ddd58083a6fe9646

@ -0,0 +1 @@
40300726574a32056d0d7bbbaf642a9e73962a9a

@ -0,0 +1 @@
ebbc77dbd1fd39bc2f92e397ddd58083a6fe9646

@ -0,0 +1 @@
40300726574a32056d0d7bbbaf642a9e73962a9a

@ -0,0 +1 @@
40300726574a32056d0d7bbbaf642a9e73962a9a

@ -10,6 +10,7 @@
#include "ash/assistant/ui/main_stage/chip_view.h" #include "ash/assistant/ui/main_stage/chip_view.h"
#include "ash/public/cpp/app_list/app_list_client.h" #include "ash/public/cpp/app_list/app_list_client.h"
#include "ash/strings/grit/ash_strings.h"
#include "ash/style/ash_color_id.h" #include "ash/style/ash_color_id.h"
#include "ash/style/pill_button.h" #include "ash/style/pill_button.h"
#include "ash/style/typography.h" #include "ash/style/typography.h"
@ -18,6 +19,7 @@
#include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_functions.h"
#include "base/rand_util.h" #include "base/rand_util.h"
#include "chromeos/ash/services/assistant/public/cpp/assistant_enums.h" #include "chromeos/ash/services/assistant/public/cpp/assistant_enums.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_impl_macros.h" #include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/color/color_id.h" #include "ui/color/color_id.h"
#include "ui/color/color_provider.h" #include "ui/color/color_provider.h"
@ -52,18 +54,6 @@ constexpr int kActionContainerBetweenChildSpacing = 8;
constexpr int kNumberOfQueryChips = 3; constexpr int kNumberOfQueryChips = 3;
constexpr char16_t kTitleTextPlaceholder[] = u"Title text";
constexpr char16_t kDescriptionTextPlaceholder[] = u"Description text";
constexpr char16_t kChipWeatherQueryPlaceholder[] = u"Weather";
constexpr char16_t kChipUnitConversionQuery1Placeholder[] = u"5 ft in m";
constexpr char16_t kChipUnitConversionQuery2Placeholder[] = u"90°F in C";
constexpr char16_t kChipTranslationQueryPlaceholder[] = u"Hi in French";
constexpr char16_t kChipDefinitionQueryPlaceholder[] = u"Define zenith";
constexpr char16_t kChipCalculationQueryPlaceholder[] = u"50+94/5";
constexpr char16_t kAssistantButtonPlaceholder[] = u"Go to Assistant";
constexpr gfx::RoundedCornersF kBackgroundRadiiClamshellLTR = {16, 4, 16, 16}; constexpr gfx::RoundedCornersF kBackgroundRadiiClamshellLTR = {16, 4, 16, 16};
constexpr gfx::RoundedCornersF kBackgroundRadiiClamshellRTL = {4, 16, 16, 16}; constexpr gfx::RoundedCornersF kBackgroundRadiiClamshellRTL = {4, 16, 16, 16};
@ -92,23 +82,28 @@ std::vector<QueryType> GetQueryChips() {
return chips; return chips;
} }
std::u16string GetQueryText(QueryType type) { int GetQueryTextId(QueryType type) {
switch (type) { switch (type) {
case QueryType::kWeather: case QueryType::kWeather:
return kChipWeatherQueryPlaceholder; return IDS_ASH_ASSISTANT_LAUNCHER_SEARCH_IPH_CHIP_WEATHER;
case QueryType::kUnitConversion1: case QueryType::kUnitConversion1:
return kChipUnitConversionQuery1Placeholder; return IDS_ASH_ASSISTANT_LAUNCHER_SEARCH_IPH_CHIP_UNIT_CONVERSION1;
case QueryType::kUnitConversion2: case QueryType::kUnitConversion2:
return kChipUnitConversionQuery2Placeholder; return IDS_ASH_ASSISTANT_LAUNCHER_SEARCH_IPH_CHIP_UNIT_CONVERSION2;
case QueryType::kTranslation: case QueryType::kTranslation:
return kChipTranslationQueryPlaceholder; return IDS_ASH_ASSISTANT_LAUNCHER_SEARCH_IPH_CHIP_TRANSLATION;
case QueryType::kDefinition: case QueryType::kDefinition:
return kChipDefinitionQueryPlaceholder; return IDS_ASH_ASSISTANT_LAUNCHER_SEARCH_IPH_CHIP_DEFINITION;
case QueryType::kCalculation: case QueryType::kCalculation:
return kChipCalculationQueryPlaceholder; return IDS_ASH_ASSISTANT_LAUNCHER_SEARCH_IPH_CHIP_CALCULATION;
} }
} }
std::u16string GetQueryText(QueryType type) {
int id = GetQueryTextId(type);
return l10n_util::GetStringUTF16(id);
}
} // namespace } // namespace
LauncherSearchIphView::LauncherSearchIphView( LauncherSearchIphView::LauncherSearchIphView(
@ -148,12 +143,14 @@ LauncherSearchIphView::LauncherSearchIphView(
text_container->SetBetweenChildSpacing(kMainLayoutBetweenChildSpacing); text_container->SetBetweenChildSpacing(kMainLayoutBetweenChildSpacing);
views::Label* title_label = text_container->AddChildView( views::Label* title_label = text_container->AddChildView(
std::make_unique<views::Label>(kTitleTextPlaceholder)); std::make_unique<views::Label>(l10n_util::GetStringUTF16(
IDS_ASH_ASSISTANT_LAUNCHER_SEARCH_IPH_TITLE)));
title_label->SetHorizontalAlignment(gfx::HorizontalAlignment::ALIGN_TO_HEAD); title_label->SetHorizontalAlignment(gfx::HorizontalAlignment::ALIGN_TO_HEAD);
title_label->SetEnabledColorId(kColorAshTextColorPrimary); title_label->SetEnabledColorId(kColorAshTextColorPrimary);
views::Label* description_label = text_container->AddChildView( views::Label* description_label = text_container->AddChildView(
std::make_unique<views::Label>(kDescriptionTextPlaceholder)); std::make_unique<views::Label>(l10n_util::GetStringUTF16(
IDS_ASH_ASSISTANT_LAUNCHER_SEARCH_IPH_DESCRIPTION)));
description_label->SetEnabledColorId(kColorAshTextColorPrimary); description_label->SetEnabledColorId(kColorAshTextColorPrimary);
const TypographyProvider* typography_provider = TypographyProvider::Get(); const TypographyProvider* typography_provider = TypographyProvider::Get();
@ -181,7 +178,8 @@ LauncherSearchIphView::LauncherSearchIphView(
actions_container->AddChildView(std::make_unique<ash::PillButton>( actions_container->AddChildView(std::make_unique<ash::PillButton>(
base::BindRepeating(&LauncherSearchIphView::OpenAssistantPage, base::BindRepeating(&LauncherSearchIphView::OpenAssistantPage,
weak_ptr_factory_.GetWeakPtr()), weak_ptr_factory_.GetWeakPtr()),
kAssistantButtonPlaceholder)); l10n_util::GetStringUTF16(
IDS_ASH_ASSISTANT_LAUNCHER_SEARCH_IPH_CHIP_ASSISTANT)));
assistant_button->SetID(ViewId::kAssistant); assistant_button->SetID(ViewId::kAssistant);
assistant_button->SetPillButtonType( assistant_button->SetPillButtonType(
PillButton::Type::kDefaultLargeWithoutIcon); PillButton::Type::kDefaultLargeWithoutIcon);