Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4138)

Unified Diff: chrome/app/PRESUBMIT.py

Issue 2757193002: Mark all IDS_FLAGS* in generated_resources.grd as translateable=false (Closed)
Patch Set: Rebased and fixed a comment in the PRESUBMIT.py Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/app/generated_resources.grd » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/app/PRESUBMIT.py
diff --git a/chrome/app/PRESUBMIT.py b/chrome/app/PRESUBMIT.py
index 519eac77cb195366afca403dcc2e2ad200b7361b..ef844534b0787e146a9803c72010accb67136299 100644
--- a/chrome/app/PRESUBMIT.py
+++ b/chrome/app/PRESUBMIT.py
@@ -34,10 +34,36 @@ def _CheckNoProductNameInGeneratedResources(input_api, output_api):
items=problems)]
return []
+def _CheckFlagsMessageNotTranslated(input_api, output_api):
+ """Check: all about:flags messages are marked as not requiring translation.
+
+ This assumes that such messages are only added to generated_resources.grd and
+ that all such messages have names starting with IDS_FLAGS_. The expected mark
+ for not requiring translation is 'translateable="false"'.
+ """
+
+ problems = []
+ filename_filter = lambda x: x.LocalPath().endswith("generated_resources.grd")
+
+ for f, line_num, line in input_api.RightHandSideLines(filename_filter):
+ if "name=\"IDS_FLAGS_" in line and not "translateable=\"false\"" in line:
+ problems.append("Missing translateable=\"false\" in %s:%d"
+ % (f.LocalPath(), line_num))
+ problems.append(line)
+
+ if problems:
+ return [output_api.PresubmitError(
+ "If you define a flag name, description or value, mark it as not "
+ "requiring translation by adding the 'translateable' attribute with "
+ "value \"false\". See https://crbug.com/587272 for more context.",
+ items=problems)]
+ return []
+
def _CommonChecks(input_api, output_api):
"""Checks common to both upload and commit."""
results = []
results.extend(_CheckNoProductNameInGeneratedResources(input_api, output_api))
+ results.extend(_CheckFlagsMessageNotTranslated(input_api, output_api))
return results
def CheckChangeOnUpload(input_api, output_api):
« no previous file with comments | « no previous file | chrome/app/generated_resources.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698