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

Tweak the presubmit message for translation screenshots

Bug: 872199
Change-Id: I4e7a409ff20819d682e5f7e9415e126563e353ef
Reviewed-on: https://chromium-review.googlesource.com/1155922Reviewed-by: default avatarDirk Pranke <dpranke@chromium.org>
Commit-Queue: Mustafa Emre Acer <meacer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#579241}
parent 33202277
...@@ -3458,17 +3458,17 @@ def _CheckTranslationScreenshots(input_api, output_api): ...@@ -3458,17 +3458,17 @@ def _CheckTranslationScreenshots(input_api, output_api):
if file_path.endswith('.grdp'): if file_path.endswith('.grdp'):
if f.OldContents(): if f.OldContents():
old_id_to_msg_map = _GetGrdpMessagesFromString( old_id_to_msg_map = _GetGrdpMessagesFromString(
unicode("\n".join(f.OldContents()))) unicode('\n'.join(f.OldContents())))
if f.NewContents(): if f.NewContents():
new_id_to_msg_map = _GetGrdpMessagesFromString( new_id_to_msg_map = _GetGrdpMessagesFromString(
unicode("\n".join(f.NewContents()))) unicode('\n'.join(f.NewContents())))
else: else:
if f.OldContents(): if f.OldContents():
old_id_to_msg_map = _GetGrdMessages( old_id_to_msg_map = _GetGrdMessages(
StringIO(unicode("\n".join(f.OldContents())))) StringIO(unicode('\n'.join(f.OldContents()))))
if f.NewContents(): if f.NewContents():
new_id_to_msg_map = _GetGrdMessages( new_id_to_msg_map = _GetGrdMessages(
StringIO(unicode("\n".join(f.NewContents())))) StringIO(unicode('\n'.join(f.NewContents()))))
# Compute added, removed and modified message IDs. # Compute added, removed and modified message IDs.
old_ids = set(old_id_to_msg_map) old_ids = set(old_id_to_msg_map)
...@@ -3503,20 +3503,20 @@ def _CheckTranslationScreenshots(input_api, output_api): ...@@ -3503,20 +3503,20 @@ def _CheckTranslationScreenshots(input_api, output_api):
results = [] results = []
if unnecessary_screenshots: if unnecessary_screenshots:
results.append(output_api.PresubmitNotifyResult( results.append(output_api.PresubmitNotifyResult(
"Do not include actual screenshots in the CL. Run " 'Do not include actual screenshots in the changelist. Run '
"tools/translate/upload_screenshots to upload them instead", 'tools/translate/upload_screenshots.py to upload them instead:',
sorted(unnecessary_screenshots))) sorted(unnecessary_screenshots)))
if missing_sha1: if missing_sha1:
results.append(output_api.PresubmitNotifyResult( results.append(output_api.PresubmitNotifyResult(
"You are adding or modifying UI messages. Add screenshots " 'You are adding or modifying UI strings.\n'
"and run tools/translate/upload_screenshots to generate and add these " 'To ensure the best translations, take screenshots of the relevant UI '
"files to the CL:", '(https://g.co/chrome/translation) and add these files to your '
sorted(missing_sha1))) 'changelist:', sorted(missing_sha1)))
if unnecessary_sha1_files: if unnecessary_sha1_files:
results.append(output_api.PresubmitNotifyResult( results.append(output_api.PresubmitNotifyResult(
"You removed messages associated with these files. Consider removing:", 'You removed strings associated with these files. Remove:',
sorted(unnecessary_sha1_files))) sorted(unnecessary_sha1_files)))
return results return results
...@@ -1881,15 +1881,17 @@ class TranslationScreenshotsTest(unittest.TestCase): ...@@ -1881,15 +1881,17 @@ class TranslationScreenshotsTest(unittest.TestCase):
</grit> </grit>
""".splitlines() """.splitlines()
DO_NOT_UPLOAD_PNG_MESSAGE = ("Do not include actual screenshots in the CL. " DO_NOT_UPLOAD_PNG_MESSAGE = ('Do not include actual screenshots in the '
"Run tools/translate/upload_screenshots to " 'changelist. Run '
"upload them instead") 'tools/translate/upload_screenshots.py to '
GENERATE_SIGNATURES_MESSAGE = ("You are adding or modifying UI messages. " 'upload them instead:')
"Add screenshots and run " GENERATE_SIGNATURES_MESSAGE = ('You are adding or modifying UI strings.\n'
"tools/translate/upload_screenshots to " 'To ensure the best translations, take '
"generate and add these files to the CL:") 'screenshots of the relevant UI '
REMOVE_SIGNATURES_MESSAGE = ("You removed messages associated with these " '(https://g.co/chrome/translation) and add '
"files. Consider removing:") 'these files to your changelist:')
REMOVE_SIGNATURES_MESSAGE = ('You removed strings associated with these '
'files. Remove:')
def makeInputApi(self, files): def makeInputApi(self, files):
input_api = MockInputApi() input_api = MockInputApi()
......
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