Commit f0e5c2c7 authored by Mark Schillaci's avatar Mark Schillaci Committed by Commit Bot

Updated a11y strings for aria-current nodes on Android

This CL updates the strings/content for aria-current nodes on
Android. In the previous CL (https://crrev.com/c/2493660), we
added a base string with a placeholder that was dynamically
populated.

This presents an issue with gendered languages and translations,
as the "current" text would need to match the gender of the
dynamically populated portion.

To fix this, we instead make each string the full content, and
removed the dynamic placeholder logic.


AX-Relnotes: N/A
Skip-Translation-Screenshots-Check: True
Bug: 1093578
Change-Id: I11ef9ae570a632176bfe9819b852f584e8f0634d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2511036Reviewed-by: default avatardanakj <danakj@chromium.org>
Reviewed-by: default avatarMark Schillaci <mschillaci@google.com>
Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Commit-Queue: Mark Schillaci <mschillaci@google.com>
Cr-Commit-Position: refs/heads/master@{#823690}
parent 7399f365
...@@ -747,41 +747,31 @@ base::string16 BrowserAccessibilityAndroid::GetAriaCurrentStateDescription() ...@@ -747,41 +747,31 @@ base::string16 BrowserAccessibilityAndroid::GetAriaCurrentStateDescription()
const { const {
content::ContentClient* content_client = content::GetContentClient(); content::ContentClient* content_client = content::GetContentClient();
base::string16 aria_current_state; int message_id;
switch (static_cast<ax::mojom::AriaCurrentState>( switch (static_cast<ax::mojom::AriaCurrentState>(
GetIntAttribute(ax::mojom::IntAttribute::kAriaCurrentState))) { GetIntAttribute(ax::mojom::IntAttribute::kAriaCurrentState))) {
case ax::mojom::AriaCurrentState::kPage: case ax::mojom::AriaCurrentState::kPage:
aria_current_state = message_id = IDS_AX_ARIA_CURRENT_PAGE;
content_client->GetLocalizedString(IDS_AX_ARIA_CURRENT_PAGE);
break; break;
case ax::mojom::AriaCurrentState::kStep: case ax::mojom::AriaCurrentState::kStep:
aria_current_state = message_id = IDS_AX_ARIA_CURRENT_STEP;
content_client->GetLocalizedString(IDS_AX_ARIA_CURRENT_STEP);
break; break;
case ax::mojom::AriaCurrentState::kLocation: case ax::mojom::AriaCurrentState::kLocation:
aria_current_state = message_id = IDS_AX_ARIA_CURRENT_LOCATION;
content_client->GetLocalizedString(IDS_AX_ARIA_CURRENT_LOCATION);
break; break;
case ax::mojom::AriaCurrentState::kDate: case ax::mojom::AriaCurrentState::kDate:
aria_current_state = message_id = IDS_AX_ARIA_CURRENT_DATE;
content_client->GetLocalizedString(IDS_AX_ARIA_CURRENT_DATE);
break; break;
case ax::mojom::AriaCurrentState::kTime: case ax::mojom::AriaCurrentState::kTime:
aria_current_state = message_id = IDS_AX_ARIA_CURRENT_TIME;
content_client->GetLocalizedString(IDS_AX_ARIA_CURRENT_TIME);
break; break;
case ax::mojom::AriaCurrentState::kTrue: case ax::mojom::AriaCurrentState::kTrue:
default: default:
aria_current_state = message_id = IDS_AX_ARIA_CURRENT_TRUE;
content_client->GetLocalizedString(IDS_AX_ARIA_CURRENT_TRUE);
break; break;
} }
return base::ReplaceStringPlaceholders( return content_client->GetLocalizedString(message_id);
content_client->GetLocalizedString(
IDS_AX_ARIA_CURRENT_STATE_DESCRIPTION_BASE),
aria_current_state, nullptr);
} }
std::string BrowserAccessibilityAndroid::GetRoleString() const { std::string BrowserAccessibilityAndroid::GetRoleString() const {
......
...@@ -805,26 +805,23 @@ below: ...@@ -805,26 +805,23 @@ below:
<message name="IDS_AX_LIST_BOX_ITEM_STATE_DESCRIPTION" desc="Accessibility state description for an item that is part of a list box"> <message name="IDS_AX_LIST_BOX_ITEM_STATE_DESCRIPTION" desc="Accessibility state description for an item that is part of a list box">
in list, item <ph name="INDEX">$1<ex>1</ex></ph> of <ph name="COUNT">$2<ex>3</ex></ph> in list, item <ph name="INDEX">$1<ex>1</ex></ph> of <ph name="COUNT">$2<ex>3</ex></ph>
</message> </message>
<message name="IDS_AX_ARIA_CURRENT_STATE_DESCRIPTION_BASE" desc="Accessibility state description for a node that has aria-current value set to something other than false">
current <ph name="TYPE">$1<ex>page</ex></ph>
</message>
<message name="IDS_AX_ARIA_CURRENT_PAGE" desc="Accessibility state description for aria-current value of page."> <message name="IDS_AX_ARIA_CURRENT_PAGE" desc="Accessibility state description for aria-current value of page.">
page current page
</message> </message>
<message name="IDS_AX_ARIA_CURRENT_STEP" desc="Accessibility state description for aria-current value of step."> <message name="IDS_AX_ARIA_CURRENT_STEP" desc="Accessibility state description for aria-current value of step.">
step current step
</message> </message>
<message name="IDS_AX_ARIA_CURRENT_LOCATION" desc="Accessibility state description for aria-current value of location."> <message name="IDS_AX_ARIA_CURRENT_LOCATION" desc="Accessibility state description for aria-current value of location.">
location current location
</message> </message>
<message name="IDS_AX_ARIA_CURRENT_DATE" desc="Accessibility state description for aria-current value of date."> <message name="IDS_AX_ARIA_CURRENT_DATE" desc="Accessibility state description for aria-current value of date.">
date current date
</message> </message>
<message name="IDS_AX_ARIA_CURRENT_TIME" desc="Accessibility state description for aria-current value of time."> <message name="IDS_AX_ARIA_CURRENT_TIME" desc="Accessibility state description for aria-current value of time.">
time current time
</message> </message>
<message name="IDS_AX_ARIA_CURRENT_TRUE" desc="Accessibility state description for aria-current value of true."> <message name="IDS_AX_ARIA_CURRENT_TRUE" desc="Accessibility state description for aria-current value of true.">
item current item
</message> </message>
</if> </if>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment