OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2009 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2009 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Helper script to repack paks for a list of locales. | 6 """Helper script to repack paks for a list of locales. |
7 | 7 |
8 Gyp doesn't have any built-in looping capability, so this just provides a way to | 8 Gyp doesn't have any built-in looping capability, so this just provides a way to |
9 loop over a list of locales when repacking pak files, thus avoiding a | 9 loop over a list of locales when repacking pak files, thus avoiding a |
10 proliferation of mostly duplicate, cut-n-paste gyp actions. | 10 proliferation of mostly duplicate, cut-n-paste gyp actions. |
(...skipping 19 matching lines...) Expand all Loading... |
30 class Usage(Exception): | 30 class Usage(Exception): |
31 def __init__(self, msg): | 31 def __init__(self, msg): |
32 self.msg = msg | 32 self.msg = msg |
33 | 33 |
34 | 34 |
35 def calc_output(locale): | 35 def calc_output(locale): |
36 """Determine the file that will be generated for the given locale.""" | 36 """Determine the file that will be generated for the given locale.""" |
37 #e.g. '<(INTERMEDIATE_DIR)/repack/da.pak', | 37 #e.g. '<(INTERMEDIATE_DIR)/repack/da.pak', |
38 if sys.platform in ('darwin',): | 38 if sys.platform in ('darwin',): |
39 # For Cocoa to find the locale at runtime, it needs to use '_' instead | 39 # For Cocoa to find the locale at runtime, it needs to use '_' instead |
40 # of '-'. (http://crbug.com/20441) | 40 # of '-' (http://crbug.com/20441). Also, 'en-US' should be represented |
| 41 # simply as 'en' (http://crbug.com/19165, http://crbug.com/25578). |
| 42 if locale == 'en-US': |
| 43 locale = 'en' |
41 return '%s/repack/%s.lproj/locale.pak' % (INT_DIR, locale.replace('-', '_')) | 44 return '%s/repack/%s.lproj/locale.pak' % (INT_DIR, locale.replace('-', '_')) |
42 else: | 45 else: |
43 return '%s/repack/%s.pak' % (INT_DIR, locale) | 46 return '%s/repack/%s.pak' % (INT_DIR, locale) |
44 | 47 |
45 | 48 |
46 def calc_inputs(locale): | 49 def calc_inputs(locale): |
47 """Determine the files that need processing for the given locale.""" | 50 """Determine the files that need processing for the given locale.""" |
48 inputs = [] | 51 inputs = [] |
49 | 52 |
50 #e.g. '<(grit_out_dir)/generated_resources_da.pak' | 53 #e.g. '<(grit_out_dir)/generated_resources_da.pak' |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 return 0 | 181 return 0 |
179 | 182 |
180 if print_outputs: | 183 if print_outputs: |
181 list_outputs(locales) | 184 list_outputs(locales) |
182 return 0 | 185 return 0 |
183 | 186 |
184 repack_locales(locales) | 187 repack_locales(locales) |
185 | 188 |
186 if __name__ == '__main__': | 189 if __name__ == '__main__': |
187 sys.exit(main(sys.argv)) | 190 sys.exit(main(sys.argv)) |
OLD | NEW |