Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 that no about:flags are marked as not requiring translation. | |
|
agrieve
2017/03/20 14:09:44
nit: Check that *all* about:flags ...
vabr (Chromium)
2017/03/20 19:03:27
Thanks!
I also inserted the work "messages" after
| |
| 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) |
| OLD | NEW |