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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/app/generated_resources.grd » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Presubmit script for changes affecting chrome/app/ 5 """Presubmit script for changes affecting chrome/app/
6 6
7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
8 for more details about the presubmit API built into depot_tools. 8 for more details about the presubmit API built into depot_tools.
9 """ 9 """
10 10
(...skipping 16 matching lines...) Expand all
27 27
28 if problems: 28 if problems:
29 return [output_api.PresubmitPromptWarning( 29 return [output_api.PresubmitPromptWarning(
30 "Don't use PRODUCT_NAME placeholders in string resources. Instead, add " 30 "Don't use PRODUCT_NAME placeholders in string resources. Instead, add "
31 "separate strings to google_chrome_strings.grd and " 31 "separate strings to google_chrome_strings.grd and "
32 "chromium_strings.grd. See http://goo.gl/6614MQ for more information." 32 "chromium_strings.grd. See http://goo.gl/6614MQ for more information."
33 "Problems with this check? Contact dubroy@chromium.org.", 33 "Problems with this check? Contact dubroy@chromium.org.",
34 items=problems)] 34 items=problems)]
35 return [] 35 return []
36 36
37 def _CheckFlagsMessageNotTranslated(input_api, output_api):
38 """Check: all about:flags messages are marked as not requiring translation.
39
40 This assumes that such messages are only added to generated_resources.grd and
41 that all such messages have names starting with IDS_FLAGS_. The expected mark
42 for not requiring translation is 'translateable="false"'.
43 """
44
45 problems = []
46 filename_filter = lambda x: x.LocalPath().endswith("generated_resources.grd")
47
48 for f, line_num, line in input_api.RightHandSideLines(filename_filter):
49 if "name=\"IDS_FLAGS_" in line and not "translateable=\"false\"" in line:
50 problems.append("Missing translateable=\"false\" in %s:%d"
51 % (f.LocalPath(), line_num))
52 problems.append(line)
53
54 if problems:
55 return [output_api.PresubmitError(
56 "If you define a flag name, description or value, mark it as not "
57 "requiring translation by adding the 'translateable' attribute with "
58 "value \"false\". See https://crbug.com/587272 for more context.",
59 items=problems)]
60 return []
61
37 def _CommonChecks(input_api, output_api): 62 def _CommonChecks(input_api, output_api):
38 """Checks common to both upload and commit.""" 63 """Checks common to both upload and commit."""
39 results = [] 64 results = []
40 results.extend(_CheckNoProductNameInGeneratedResources(input_api, output_api)) 65 results.extend(_CheckNoProductNameInGeneratedResources(input_api, output_api))
66 results.extend(_CheckFlagsMessageNotTranslated(input_api, output_api))
41 return results 67 return results
42 68
43 def CheckChangeOnUpload(input_api, output_api): 69 def CheckChangeOnUpload(input_api, output_api):
44 return _CommonChecks(input_api, output_api) 70 return _CommonChecks(input_api, output_api)
45 71
46 def CheckChangeOnCommit(input_api, output_api): 72 def CheckChangeOnCommit(input_api, output_api):
47 return _CommonChecks(input_api, output_api) 73 return _CommonChecks(input_api, output_api)
OLDNEW
« 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