| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright 2009 Google Inc. All rights reserved. | 2 # Copyright 2009 Google Inc. All rights reserved. |
| 3 | 3 |
| 4 """This script generates an rc file and header (setup_strings.{rc,h}) to be | 4 """This script generates an rc file and header (setup_strings.{rc,h}) to be |
| 5 included in setup.exe. The rc file includes translations for strings pulled | 5 included in setup.exe. The rc file includes translations for strings pulled |
| 6 from generated_resource.grd and the localized .xtb files. | 6 from generated_resource.grd and the localized .xtb files. |
| 7 | 7 |
| 8 The header file includes IDs for each string, but also has values to allow | 8 The header file includes IDs for each string, but also has values to allow |
| 9 getting a string based on a language offset. For example, the header file | 9 getting a string based on a language offset. For example, the header file |
| 10 looks like this: | 10 looks like this: |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 This allows us to lookup an an ID for a string by adding IDS_MY_STRING_BASE and | 23 This allows us to lookup an an ID for a string by adding IDS_MY_STRING_BASE and |
| 24 IDS_L10N_OFFSET_* for the language we are interested in. | 24 IDS_L10N_OFFSET_* for the language we are interested in. |
| 25 """ | 25 """ |
| 26 | 26 |
| 27 import glob | 27 import glob |
| 28 import os | 28 import os |
| 29 import sys | 29 import sys |
| 30 from xml.dom import minidom | 30 from xml.dom import minidom |
| 31 | 31 |
| 32 # We are expected to use ../../../../third_party/python_24/python.exe |
| 32 from google import path_utils | 33 from google import path_utils |
| 33 | 34 |
| 35 # Quick hack to fix the path. |
| 36 sys.path.append(os.path.abspath('../../tools/grit/grit/extern')) |
| 34 import FP | 37 import FP |
| 35 | 38 |
| 36 # The IDs of strings we want to import from generated_resources.grd and include | 39 # The IDs of strings we want to import from generated_resources.grd and include |
| 37 # in setup.exe's resources. | 40 # in setup.exe's resources. |
| 38 kStringIds = [ | 41 kStringIds = [ |
| 39 'IDS_PRODUCT_NAME', | 42 'IDS_PRODUCT_NAME', |
| 40 'IDS_UNINSTALL_CHROME', | 43 'IDS_UNINSTALL_CHROME', |
| 41 'IDS_ABOUT_VERSION_COMPANY_NAME', | 44 'IDS_ABOUT_VERSION_COMPANY_NAME', |
| 42 'IDS_INSTALL_HIGHER_VERSION', | 45 'IDS_INSTALL_HIGHER_VERSION', |
| 43 'IDS_INSTALL_USER_LEVEL_EXISTS', | 46 'IDS_INSTALL_USER_LEVEL_EXISTS', |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 translated_strings = CollectTranslatedStrings() | 191 translated_strings = CollectTranslatedStrings() |
| 189 kFilebase = os.path.join(argv[1], 'installer_util_strings') | 192 kFilebase = os.path.join(argv[1], 'installer_util_strings') |
| 190 WriteRCFile(translated_strings, kFilebase) | 193 WriteRCFile(translated_strings, kFilebase) |
| 191 WriteHeaderFile(translated_strings, kFilebase) | 194 WriteHeaderFile(translated_strings, kFilebase) |
| 192 | 195 |
| 193 if '__main__' == __name__: | 196 if '__main__' == __name__: |
| 194 if len(sys.argv) < 2: | 197 if len(sys.argv) < 2: |
| 195 print 'Usage:\n %s <output_directory>' % sys.argv[0] | 198 print 'Usage:\n %s <output_directory>' % sys.argv[0] |
| 196 sys.exit(1) | 199 sys.exit(1) |
| 197 main(sys.argv) | 200 main(sys.argv) |
| OLD | NEW |