a11y: Make list and icon content descriptions translatable - #2068
Open
NAME-ASHWANIYADAV wants to merge 1 commit into
Open
a11y: Make list and icon content descriptions translatable#2068NAME-ASHWANIYADAV wants to merge 1 commit into
NAME-ASHWANIYADAV wants to merge 1 commit into
Conversation
Fourteen layouts hardcoded English content descriptions, so screen readers announced untranslated text. Two of them were also wrong: the add-on permissions list claimed to be the add-ons list, and the SSL icon named the widget rather than the connection state.
Contributor
Author
|
@svillar PTAL !! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2067
What
Replaces the fourteen hardcoded English
android:contentDescriptionliterals left in the layout tree with translatable@stringreferences, adding thirteen strings tovalues/strings.xml(one is shared by two layouts), each with a translator comment in the style used by the existing*_content_descriptionentries.bookmarks.xml:106"Bookmarks feed"bookmarks_list_content_description- "List of bookmarks"history.xml:102"History feed"history_list_content_description- "List of visited websites"downloads.xml:82"Downloads"downloads_list_content_description- "List of downloaded files"system_notifications.xml:66"System notifications"notifications_list_content_description- "List of notifications"addons_list.xml:34"Addons List"addons_list_content_description- "List of add-ons"addon_options_permissions.xml:37"Addons List"addons_permissions_list_content_description- "List of add-on permissions"options_saved_logins.xml:93"Logins List"privacy_options_saved_logins_list_content_description- "List of saved logins"prompt_select_login.xml:42"Saved Logins list"autofill_dialog_use_login_list_content_description- "List of saved logins to choose from"options_custom_search_engines.xml:82"Search Engines List"custom_search_engines_list_content_description- "List of custom search engines"custom_search_engine_item.xml:87"Delete custom search engine"custom_search_engine_item_delete_content_description- same textnavigation_url.xml:171,title_bar.xml:55"SSL icon"insecure_connection_content_description- "Connection is not secure"new_tab.xml:86"Top sites"new_tab_top_sites_list_content_description- "List of most visited sites"new_tab.xml:109"Experiences"new_tab_experiences_list_content_description- "List of featured experiences"Why
Hardcoded literals never reach the translation pipeline, so these announcements stay English in every locale. This clears the last of them: of the 38
android:contentDescriptionoccurrences across all 157 layout files - every flavor directory included - the rest were already@stringreferences.Two of the fourteen also said the wrong thing, so the replacement is a copy fix as well as a translation one:
addon_options_permissions.xml:37labelled@+id/permissions_listas "Addons List", but that list holds one add-on's requested permissions (AddonOptionsPermissionsViewfills it fromaddon.translatePermissions(...)).ic_icon_security_state_insecuredrawable, shown only whenviewmodel.isInsecureVisible. The label named the widget rather than the state, so it now says the connection is not secure. One string serves both layouts.The remaining twelve keep their existing meaning and follow the "List of …" phrasing introduced by the two merged language-list descriptions. New strings were preferred over reusing nearby header strings so the list announcement does not simply repeat the visible header, and so list labels are not coupled to header wording.
Where each string is placed: next to the feature strings it belongs with (for example
bookmarks_list_content_descriptionright afterbookmarks_loading), rather than appended at the end.Related, left out deliberately
title_bar.xml:67setsandroid:contentDescription="Page URL"on the@+id/urlTextView. AcontentDescriptionon a TextView replaces its text for accessibility services, which would normally mask the URL - but that view binds its text viatools:text="@{viewmodel.titleBarUrl}", a design-time attribute, so it appears not to be populated at runtime. Whether the right fix is to drop the description or to fix the binding depends on what the view actually renders, which I cannot check without a device, so I left it out rather than guess. Happy to file it separately.Testing
./gradlew assembleNoapiArm64GeckoGenericDebug./gradlew testNoapiArm64GeckoGenericDebugUnitTestChecked without a build: all fourteen layouts and
strings.xmlparse; every new@stringreference resolves to a string defined invalues/strings.xml; no duplicate string names; and none of the thirteen new names already exists in anyvalues-*translation file.