Commit d3ca8be8 authored by Mustafa Emre Acer's avatar Mustafa Emre Acer Committed by Commit Bot

Rename is_accessibility attribute in UI strings

This is a follow up to https://crrev.com/c/2274667

This attribute was recently introduced so that developers wouldn't
get presubmit errors for accessibility labels that are not shown in the
UI. However, screen readers do actually display most accessibility
labels, so having screenshots for these strings are still useful. Still,
there is a small subset of accessibility labels that are never
displayed. This CL renames the existing attribute to make the intention
of the carveout clear.

Bug: 1094077
Change-Id: I4c171d29fea0aac611cb07759422bd5c25688017
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2285076
Commit-Queue: Mustafa Emre Acer <meacer@chromium.org>
Reviewed-by: default avatarDirk Pranke <dpranke@google.com>
Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#786025}
parent ab9f7839
......@@ -2777,7 +2777,7 @@ class StringTest(unittest.TestCase):
Non translateable message 1, should be ignored
</message>
<message name="IDS_TEST_STRING_ACCESSIBILITY"
is_accessibility="true">
is_accessibility_with_no_ui="true">
Accessibility label 1, should be ignored
</message>
</messages>
......
......@@ -428,14 +428,14 @@ class Node(object):
else:
return self.attrs['translateable'] == 'true'
def IsAccessibility(self):
'''Returns true if the node is marked as an accessibility label. Otherwise
returns false. This label can be used to determine if the text requires
screenshots, for example.'''
if not 'is_accessibility' in self.attrs:
def IsAccessibilityWithNoUI(self):
'''Returns true if the node is marked as an accessibility label and the
message isn't shown in the UI. Otherwise returns false. This label is
used to determine if the text requires screenshots.'''
if not 'is_accessibility_with_no_ui' in self.attrs:
return False
else:
return self.attrs['is_accessibility'] == 'true'
return self.attrs['is_accessibility_with_no_ui'] == 'true'
def GetNodeById(self, id):
'''Returns the node in the subtree parented by this node that has a 'name'
......
......@@ -93,7 +93,8 @@ class MessageNode(base.ContentNode):
if name not in [
'name', 'offset', 'translateable', 'desc', 'meaning',
'internal_comment', 'shortcut_groups', 'custom_type', 'validation_expr',
'use_name_for_id', 'sub_variable', 'formatter_data', 'is_accessibility'
'use_name_for_id', 'sub_variable', 'formatter_data',
'is_accessibility_with_no_ui'
]:
return False
if (name in ('translateable', 'sub_variable') and
......@@ -115,7 +116,7 @@ class MessageNode(base.ContentNode):
'desc': '',
'formatter_data': '',
'internal_comment': '',
'is_accessibility': 'false',
'is_accessibility_with_no_ui': 'false',
'meaning': '',
'shortcut_groups': '',
'sub_variable': 'false',
......
......@@ -48,7 +48,7 @@ def GetGrdMessages(grd_path_or_string, dir_path):
return {
msg.attrs['name']: msg
for msg in doc.GetChildrenOfType(grit.node.message.MessageNode)
if msg.IsTranslateable() and not msg.IsAccessibility()
if msg.IsTranslateable() and not msg.IsAccessibilityWithNoUI()
}
......
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