0

Use different "show all" strings for every category.

Using a placeholder for this string does not give good
translations. Write out every string explicitly.

Also, turns out the original strings didn't match the specs
anyway.

Bug: b:345303965
Change-Id: I71b57efe7281359927675565e5c20e68e909d43a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5792879
Reviewed-by: Michelle Chen <michellegc@google.com>
Commit-Queue: Darren Shen <shend@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1343353}
This commit is contained in:
Darren Shen
2024-08-19 06:48:53 +00:00
committed by Chromium LUCI CQ
parent f031fbef87
commit 837911fde2
7 changed files with 40 additions and 7 deletions

@ -7542,9 +7542,17 @@ New install
desc="This string appears as the label text of a button. The button is part of a truncated list of search results. Clicking the button will show all the search results.">
Show all
</message>
<message name="IDS_PICKER_SEE_MORE_BUTTON_ACCESSIBLE_NAME"
desc="This string is read out by a screen reader to describe a button. The button is part of a truncated list of search results of a particular category (e.g. Google Drive files). The placeholder is the name of the category. Clicking the button will show all the search results for that particular category of results.">
Show all <ph name="CATEGORY_NAME">$1<ex>Drive Files</ex></ph>
<message name="IDS_PICKER_SEE_MORE_LINKS_BUTTON_ACCESSIBLE_NAME"
desc="This string is read out by a screen reader to describe a button. The button is part of a truncated list of search results from the user's browsing history. Clicking the button will show all the browsing history search results.">
Show all browsing history content
</message>
<message name="IDS_PICKER_SEE_MORE_LOCAL_FILES_BUTTON_ACCESSIBLE_NAME"
desc="This string is read out by a screen reader to describe a button. The button is part of a truncated list of search results from the ChromeOS Files app. Clicking the button will show all the search results from Files. 'Files' is the ChromeOS Files app product name and the correct localized version of the product name should be used.">
Show all Files content
</message>
<message name="IDS_PICKER_SEE_MORE_DRIVE_FILES_BUTTON_ACCESSIBLE_NAME"
desc="This string is read out by a screen reader to describe a button. The button is part of a truncated list of Google Drive search results. Clicking the button will show all the Google Drive search results. 'Google Drive' is a product name and the correct localized version of the product name should be used.">
Show all Google Drive content
</message>
<message name="IDS_PICKER_MORE_EMOJIS_BUTTON_ACCESSIBLE_NAME"
desc="This string is appears as the tooltip of a button. The button is part of a row of emojis. Clicking the button will show more emojis.">

@ -1 +0,0 @@
e93ef41c56cbac4fb8991aaccbd2a5329a084c00

@ -0,0 +1 @@
7f620556f94a7c55250c7b748a06a11d016c2245

@ -0,0 +1 @@
739b2ab4c736b19677ad967aa65e42accc5473b7

@ -0,0 +1 @@
ddf50c57187c14f81bb1f0bb0fa2ac8fe476c96f

@ -58,6 +58,27 @@ constexpr gfx::Size kNoResultsIllustrationSize(200, 100);
constexpr int kMaxIndexForMetrics = 10;
std::u16string GetAccessibleNameForSeeMoreButton(
PickerSectionType section_type) {
switch (section_type) {
case PickerSectionType::kLinks:
return l10n_util::GetStringUTF16(
IDS_PICKER_SEE_MORE_LINKS_BUTTON_ACCESSIBLE_NAME);
case PickerSectionType::kLocalFiles:
return l10n_util::GetStringUTF16(
IDS_PICKER_SEE_MORE_LOCAL_FILES_BUTTON_ACCESSIBLE_NAME);
case PickerSectionType::kDriveFiles:
return l10n_util::GetStringUTF16(
IDS_PICKER_SEE_MORE_DRIVE_FILES_BUTTON_ACCESSIBLE_NAME);
case PickerSectionType::kNone:
case PickerSectionType::kClipboard:
case PickerSectionType::kExamples:
case PickerSectionType::kEditorWrite:
case PickerSectionType::kEditorRewrite:
return u"";
}
}
} // namespace
PickerSearchResultsView::PickerSearchResultsView(
@ -193,8 +214,7 @@ void PickerSearchResultsView::AppendSearchResults(
if (section.has_more_results()) {
section_view->AddTitleTrailingLink(
l10n_util::GetStringUTF16(IDS_PICKER_SEE_MORE_BUTTON_TEXT),
l10n_util::GetStringFUTF16(IDS_PICKER_SEE_MORE_BUTTON_ACCESSIBLE_NAME,
section_title),
GetAccessibleNameForSeeMoreButton(section.type()),
base::BindRepeating(&PickerSearchResultsView::OnTrailingLinkClicked,
base::Unretained(this), section.type()));
}

@ -347,7 +347,10 @@ TEST_F(PickerSearchResultsViewTest, ShowsSeeMoreLinkWhenThereAreMoreResults) {
ElementsAre(Pointee(Property(
"title_trailing_link_for_testing",
&PickerSectionView::title_trailing_link_for_testing,
Property(&views::View::GetAccessibleName, u"Show all Files")))));
Property(
&views::View::GetAccessibleName,
l10n_util::GetStringUTF16(
IDS_PICKER_SEE_MORE_LOCAL_FILES_BUTTON_ACCESSIBLE_NAME))))));
}
TEST_F(PickerSearchResultsViewTest,