OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright 2015 The Chromium Authors. All rights reserved. | 3 # Copyright 2015 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 """Creates a resources.zip for locale .pak files. | 6 """Creates a resources.zip for locale .pak files. |
7 | 7 |
8 Places the locale.pak files into appropriate resource configs | 8 Places the locale.pak files into appropriate resource configs |
9 (e.g. en-GB.pak -> res/raw-en/en_gb.lpak). Also generates a locale_paks | 9 (e.g. en-GB.pak -> res/raw-en/en_gb.lpak). Also generates a locale_paks |
10 TypedArray so that resource files can be enumerated at runtime. | 10 TypedArray so that resource files can be enumerated at runtime. |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 parser.add_option('--resources-zip', help='Path to output resources.zip') | 86 parser.add_option('--resources-zip', help='Path to output resources.zip') |
87 parser.add_option('--print-languages', | 87 parser.add_option('--print-languages', |
88 action='store_true', | 88 action='store_true', |
89 help='Print out the list of languages that cover the given locale paks ' | 89 help='Print out the list of languages that cover the given locale paks ' |
90 '(using Android\'s language codes)') | 90 '(using Android\'s language codes)') |
91 | 91 |
92 options, _ = parser.parse_args() | 92 options, _ = parser.parse_args() |
93 build_utils.CheckOptions(options, parser, | 93 build_utils.CheckOptions(options, parser, |
94 required=['locale_paks']) | 94 required=['locale_paks']) |
95 | 95 |
96 sources = build_utils.ParseGypList(options.locale_paks) | 96 sources = build_utils.ParseGnList(options.locale_paks) |
97 | 97 |
98 if options.depfile: | 98 if options.depfile: |
99 deps = sources + build_utils.GetPythonDependencies() | 99 deps = sources + build_utils.GetPythonDependencies() |
100 build_utils.WriteDepfile(options.depfile, deps) | 100 build_utils.WriteDepfile(options.depfile, deps) |
101 | 101 |
102 mappings, lang_to_locale_map = ComputeMappings(sources) | 102 mappings, lang_to_locale_map = ComputeMappings(sources) |
103 if options.print_languages: | 103 if options.print_languages: |
104 print '\n'.join(sorted(lang_to_locale_map)) | 104 print '\n'.join(sorted(lang_to_locale_map)) |
105 | 105 |
106 if options.resources_zip: | 106 if options.resources_zip: |
(...skipping 10 matching lines...) Expand all Loading... |
117 xml = CreateLocalePaksXml(names + ['en_us.lpak']) | 117 xml = CreateLocalePaksXml(names + ['en_us.lpak']) |
118 out.writestr(os.path.join(dest_dir, 'locale-paks.xml'), xml) | 118 out.writestr(os.path.join(dest_dir, 'locale-paks.xml'), xml) |
119 | 119 |
120 for lang, names in lang_to_locale_map.iteritems(): | 120 for lang, names in lang_to_locale_map.iteritems(): |
121 WriteValuesFile(lang, names) | 121 WriteValuesFile(lang, names) |
122 WriteValuesFile(None, []) | 122 WriteValuesFile(None, []) |
123 | 123 |
124 | 124 |
125 if __name__ == '__main__': | 125 if __name__ == '__main__': |
126 sys.exit(main()) | 126 sys.exit(main()) |
OLD | NEW |