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

Ignore non-translateable strings from translation screenshot presubmit

This CL ignores messages marked as `translateable="false"` from the
_CheckStrings presubmit.

Bug: 1085611
Change-Id: I0ba74ef04a3b78ae39107989da34d3df7c1ba922
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2226070Reviewed-by: default avatarDirk Pranke <dpranke@chromium.org>
Commit-Queue: Mustafa Emre Acer <meacer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#774860}
parent c917ceb7
......@@ -2726,6 +2726,10 @@ class StringTest(unittest.TestCase):
<message name="IDS_TEST1">
Test string 1
</message>
<message name="IDS_TEST_STRING_NON_TRANSLATEABLE1"
translateable="false">
Non translateable message 1, should be ignored
</message>
</messages>
</release>
</grit>
......@@ -2741,6 +2745,10 @@ class StringTest(unittest.TestCase):
<message name="IDS_TEST2">
Test string 2
</message>
<message name="IDS_TEST_STRING_NON_TRANSLATEABLE2"
translateable="false">
Non translateable message 2, should be ignored
</message>
</messages>
</release>
</grit>
......
......@@ -34,7 +34,9 @@ TAGS_TO_IGNORE = (
def GetGrdMessages(grd_path_or_string, dir_path):
"""Load the grd file and return a dict of message ids to messages."""
"""Load the grd file and return a dict of message ids to messages.
Ignores non-translateable messages."""
doc = grit.grd_reader.Parse(
grd_path_or_string,
dir_path,
......@@ -46,6 +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()
}
......
......@@ -33,7 +33,7 @@ class GrdHelperTest(unittest.TestCase):
# listed here.
self.assertTrue('IDS_TEST_STRING1' in messages)
self.assertTrue('IDS_TEST_STRING2' in messages)
self.assertTrue('IDS_TEST_STRING_NON_TRANSLATEABLE' in messages)
self.assertFalse('IDS_TEST_STRING_NON_TRANSLATEABLE' in messages)
def testReadGrdpMessages(self):
messages = grd_helper.GetGrdpMessagesFromString(
......
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