scanner: Update placeholder strings for action success toast.
Add a toast message for each action type and the accessible name of the toast's feedback icon button. The toast messages are not finalized yet, so mark them as non-translateable for now. Bug: b:382182688, b:375967525 Change-Id: I068d69496f20983354ef0bd194e1f69965735b4d Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6210898 Reviewed-by: Michael Cui <mlcui@google.com> Commit-Queue: Michelle Chen <michellegc@google.com> Cr-Commit-Position: refs/heads/main@{#1413877}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
de2e71c166
commit
446344a5ed
@ -6862,6 +6862,21 @@ Here are some things you can try to get started.
|
||||
<message name="IDS_ASH_SCANNER_ACTION_COPY_TEXT_AND_FORMAT" desc="The label on a button that can be clicked to copy text with formatting from the contents of a screenshot." translateable="false">
|
||||
Copy text and format
|
||||
</message>
|
||||
<message name="IDS_ASH_SCANNER_ACTION_SUCCESS_TOAST_CREATE_EVENT" desc="The message shown on a toast to indicate that event details were created from the contents of a screenshot." translateable="false">
|
||||
Created event
|
||||
</message>
|
||||
<message name="IDS_ASH_SCANNER_ACTION_SUCCESS_TOAST_CREATE_CONTACT" desc="The message shown on a toast to indicate a new contact was created from the contents of a screenshot." translateable="false">
|
||||
Created contact
|
||||
</message>
|
||||
<message name="IDS_ASH_SCANNER_ACTION_SUCCESS_TOAST_CREATE_DOC" desc="The message shown on a toast to indicate a new Google Doc was created from the contents of a screenshot." translateable="false">
|
||||
Created Google Doc
|
||||
</message>
|
||||
<message name="IDS_ASH_SCANNER_ACTION_SUCCESS_TOAST_CREATE_SHEET" desc="The message shown on a toast to indicate a new Google Sheet was created from the contents of a screenshot." translateable="false">
|
||||
Created Google Sheet
|
||||
</message>
|
||||
<message name="IDS_ASH_SCANNER_ACTION_SUCCESS_TOAST_COPY_TEXT_AND_FORMAT" desc="The message shown on a toast to indicate text with formatting was copied to the user's clipboard from the contents of a screenshot." translateable="false">
|
||||
Text copied to Clipboard
|
||||
</message>
|
||||
<message name="IDS_ASH_SCANNER_ACTION_FAILURE_TOAST_CREATE_EVENT" desc="The message shown on a toast to indicate an error occurred when trying to add an event to the user's calendar from the contents of a screenshot.">
|
||||
Couldn't add to Calendar
|
||||
</message>
|
||||
@ -6877,6 +6892,9 @@ Here are some things you can try to get started.
|
||||
<message name="IDS_ASH_SCANNER_ACTION_FAILURE_TOAST_COPY_TEXT_AND_FORMAT" desc="The message shown on a toast to indicate an error occurred when trying to copy text with formatting from the contents of a screenshot.">
|
||||
Couldn’t copy with formatting
|
||||
</message>
|
||||
<message name="IDS_ASH_SCANNER_ACTION_TOAST_FEEDBACK_ICON_ACCESSIBLE_NAME" desc="The accessible name of the feedback icon button on a toast shown when an action has been completed. Clicking the feedback icon button opens a dialog for users to report feedback.">
|
||||
Send feedback
|
||||
</message>
|
||||
<message name="IDS_ASH_SCANNER_ERROR_TRY_AGAIN_LINK_TEXT" desc="The text on a try again link shown next to an error message indicating that something went wrong. The link can be pressed to try the action again.">
|
||||
Try again
|
||||
</message>
|
||||
|
1
ash/ash_strings_grd/IDS_ASH_SCANNER_ACTION_TOAST_FEEDBACK_ICON_ACCESSIBLE_NAME.png.sha1
Normal file
1
ash/ash_strings_grd/IDS_ASH_SCANNER_ACTION_TOAST_FEEDBACK_ICON_ACCESSIBLE_NAME.png.sha1
Normal file
@ -0,0 +1 @@
|
||||
1a6da14878ec023b2a98ad350b1908e56ff4bad9
|
@ -70,6 +70,29 @@ constexpr size_t kUserFacingStringDepthLimit = 20;
|
||||
constexpr size_t kUserFacingStringOutputLimit =
|
||||
std::numeric_limits<size_t>::max();
|
||||
|
||||
std::u16string GetToastMessageForActionSuccess(
|
||||
manta::proto::ScannerAction::ActionCase action_case) {
|
||||
switch (action_case) {
|
||||
case manta::proto::ScannerAction::kNewEvent:
|
||||
return l10n_util::GetStringUTF16(
|
||||
IDS_ASH_SCANNER_ACTION_SUCCESS_TOAST_CREATE_EVENT);
|
||||
case manta::proto::ScannerAction::kNewContact:
|
||||
return l10n_util::GetStringUTF16(
|
||||
IDS_ASH_SCANNER_ACTION_SUCCESS_TOAST_CREATE_CONTACT);
|
||||
case manta::proto::ScannerAction::kNewGoogleDoc:
|
||||
return l10n_util::GetStringUTF16(
|
||||
IDS_ASH_SCANNER_ACTION_SUCCESS_TOAST_CREATE_DOC);
|
||||
case manta::proto::ScannerAction::kNewGoogleSheet:
|
||||
return l10n_util::GetStringUTF16(
|
||||
IDS_ASH_SCANNER_ACTION_SUCCESS_TOAST_CREATE_SHEET);
|
||||
case manta::proto::ScannerAction::kCopyToClipboard:
|
||||
return l10n_util::GetStringUTF16(
|
||||
IDS_ASH_SCANNER_ACTION_SUCCESS_TOAST_COPY_TEXT_AND_FORMAT);
|
||||
case manta::proto::ScannerAction::ACTION_NOT_SET:
|
||||
NOTREACHED();
|
||||
}
|
||||
}
|
||||
|
||||
std::u16string GetToastMessageForActionFailure(
|
||||
manta::proto::ScannerAction::ActionCase action_case) {
|
||||
switch (action_case) {
|
||||
@ -455,13 +478,9 @@ void ScannerController::OnActionFinished(
|
||||
/*by_user=*/false);
|
||||
|
||||
if (success) {
|
||||
// TODO: crbug.com/375967525 - Finalize the action toast strings.
|
||||
std::u16string toast_text =
|
||||
action_case == manta::proto::ScannerAction::kCopyToClipboard
|
||||
? u"Text copied to clipboard"
|
||||
: u"Action succeeded";
|
||||
ToastData toast_data(kScannerActionSuccessToastId,
|
||||
ToastCatalogName::kScannerActionSuccess, toast_text);
|
||||
ToastCatalogName::kScannerActionSuccess,
|
||||
GetToastMessageForActionSuccess(action_case));
|
||||
|
||||
// TODO: b/367882164 - Pass in the account ID to this method to ensure that
|
||||
// the feedback form is shown for the same account that performed the
|
||||
@ -472,7 +491,8 @@ void ScannerController::OnActionFinished(
|
||||
|
||||
if (prefs && prefs->GetBoolean(prefs::kScannerFeedbackEnabled)) {
|
||||
toast_data.button_type = ToastData::ButtonType::kIconButton;
|
||||
toast_data.button_text = u"Send feedback";
|
||||
toast_data.button_text = l10n_util::GetStringUTF16(
|
||||
IDS_ASH_SCANNER_ACTION_TOAST_FEEDBACK_ICON_ACCESSIBLE_NAME);
|
||||
toast_data.button_icon = &kFeedbackIcon;
|
||||
// TODO: b/259100049 - Change this to be `BindOnce` once
|
||||
// `ToastData::button_callback` is migrated to be a `OnceClosure`.
|
||||
|
Reference in New Issue
Block a user