| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 | 2 |
| 3 # Copyright (c) 2009 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2009 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 | 6 |
| 7 # Usage: generate_localizer [xib_path] [output_dot_h_path] [output_dot_mm_path] | 7 # Usage: generate_localizer [xib_path] [output_dot_h_path] [output_dot_mm_path] |
| 8 # | 8 # |
| 9 # Extracts all the localizable strings that start with "^IDS" from the given | 9 # Extracts all the localizable strings that start with "^IDS" from the given |
| 10 # xib file, and then generates a localizer to process those strings. | 10 # xib file, and then generates a localizer to process those strings. |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 } | 88 } |
| 89 h_file = localizer_template_h % values_dict | 89 h_file = localizer_template_h % values_dict |
| 90 return h_file | 90 return h_file |
| 91 | 91 |
| 92 | 92 |
| 93 def Main(argv=None): | 93 def Main(argv=None): |
| 94 global generate_localizer | 94 global generate_localizer |
| 95 generate_localizer = os.path.basename(argv[0]) | 95 generate_localizer = os.path.basename(argv[0]) |
| 96 | 96 |
| 97 # Args | 97 # Args |
| 98 if len(argv) < 4: | 98 if len(argv) < 3: |
| 99 sys.stderr.write('%s:0: error: Expected output file and then xibs\n' % | 99 sys.stderr.write('%s:0: error: Expected output file and then xibs\n' % |
| 100 generate_localizer); | 100 generate_localizer); |
| 101 return 1 | 101 return 1 |
| 102 output_path = argv[1]; | 102 output_path = argv[1]; |
| 103 xib_paths = argv[2:] | 103 xib_paths = argv[2:] |
| 104 | 104 |
| 105 full_constants_list = [] | 105 full_constants_list = [] |
| 106 for xib_path in xib_paths: | 106 for xib_path in xib_paths: |
| 107 # Run ibtool and convert to something Python can deal with | 107 # Run ibtool and convert to something Python can deal with |
| 108 plist_string = xib_localizable_strings(xib_path) | 108 plist_string = xib_localizable_strings(xib_path) |
| (...skipping 15 matching lines...) Expand all Loading... |
| 124 | 124 |
| 125 # Write out the file | 125 # Write out the file |
| 126 file_fd = open(output_path, 'w') | 126 file_fd = open(output_path, 'w') |
| 127 file_fd.write(h_file_content) | 127 file_fd.write(h_file_content) |
| 128 file_fd.close() | 128 file_fd.close() |
| 129 | 129 |
| 130 return 0 | 130 return 0 |
| 131 | 131 |
| 132 if __name__ == '__main__': | 132 if __name__ == '__main__': |
| 133 sys.exit(Main(sys.argv)) | 133 sys.exit(Main(sys.argv)) |
| OLD | NEW |