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): ...@@ -2777,7 +2777,7 @@ class StringTest(unittest.TestCase):
Non translateable message 1, should be ignored Non translateable message 1, should be ignored
</message> </message>
<message name="IDS_TEST_STRING_ACCESSIBILITY" <message name="IDS_TEST_STRING_ACCESSIBILITY"
is_accessibility="true"> is_accessibility_with_no_ui="true">
Accessibility label 1, should be ignored Accessibility label 1, should be ignored
</message> </message>
</messages> </messages>
......
...@@ -428,14 +428,14 @@ class Node(object): ...@@ -428,14 +428,14 @@ class Node(object):
else: else:
return self.attrs['translateable'] == 'true' return self.attrs['translateable'] == 'true'
def IsAccessibility(self): def IsAccessibilityWithNoUI(self):
'''Returns true if the node is marked as an accessibility label. Otherwise '''Returns true if the node is marked as an accessibility label and the
returns false. This label can be used to determine if the text requires message isn't shown in the UI. Otherwise returns false. This label is
screenshots, for example.''' used to determine if the text requires screenshots.'''
if not 'is_accessibility' in self.attrs: if not 'is_accessibility_with_no_ui' in self.attrs:
return False return False
else: else:
return self.attrs['is_accessibility'] == 'true' return self.attrs['is_accessibility_with_no_ui'] == 'true'
def GetNodeById(self, id): def GetNodeById(self, id):
'''Returns the node in the subtree parented by this node that has a 'name' '''Returns the node in the subtree parented by this node that has a 'name'
......
...@@ -93,7 +93,8 @@ class MessageNode(base.ContentNode): ...@@ -93,7 +93,8 @@ class MessageNode(base.ContentNode):
if name not in [ if name not in [
'name', 'offset', 'translateable', 'desc', 'meaning', 'name', 'offset', 'translateable', 'desc', 'meaning',
'internal_comment', 'shortcut_groups', 'custom_type', 'validation_expr', '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 return False
if (name in ('translateable', 'sub_variable') and if (name in ('translateable', 'sub_variable') and
...@@ -115,7 +116,7 @@ class MessageNode(base.ContentNode): ...@@ -115,7 +116,7 @@ class MessageNode(base.ContentNode):
'desc': '', 'desc': '',
'formatter_data': '', 'formatter_data': '',
'internal_comment': '', 'internal_comment': '',
'is_accessibility': 'false', 'is_accessibility_with_no_ui': 'false',
'meaning': '', 'meaning': '',
'shortcut_groups': '', 'shortcut_groups': '',
'sub_variable': 'false', 'sub_variable': 'false',
......
...@@ -48,7 +48,7 @@ def GetGrdMessages(grd_path_or_string, dir_path): ...@@ -48,7 +48,7 @@ def GetGrdMessages(grd_path_or_string, dir_path):
return { return {
msg.attrs['name']: msg msg.attrs['name']: msg
for msg in doc.GetChildrenOfType(grit.node.message.MessageNode) 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