| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 """Generates .h and .rc files for installer strings. Run "python | 6 """Generates .h and .rc files for installer strings. Run "python |
| 7 create_string_rc.py" for usage details. | 7 create_string_rc.py" for usage details. |
| 8 | 8 |
| 9 This script generates an rc file and header (NAME.{rc,h}) to be included in | 9 This script generates an rc file and header (NAME.{rc,h}) to be included in |
| 10 setup.exe. The rc file includes translations for strings pulled from the given | 10 setup.exe. The rc file includes translations for strings pulled from the given |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 sys.path.append(os.path.join(BASEDIR, '../../../../tools/grit')) | 41 sys.path.append(os.path.join(BASEDIR, '../../../../tools/grit')) |
| 42 sys.path.append(os.path.join(BASEDIR, '../../../../tools/python')) | 42 sys.path.append(os.path.join(BASEDIR, '../../../../tools/python')) |
| 43 | 43 |
| 44 from grit.extern import tclib | 44 from grit.extern import tclib |
| 45 | 45 |
| 46 # The IDs of strings we want to import from the .grd files and include in | 46 # The IDs of strings we want to import from the .grd files and include in |
| 47 # setup.exe's resources. | 47 # setup.exe's resources. |
| 48 STRING_IDS = [ | 48 STRING_IDS = [ |
| 49 'IDS_ABOUT_VERSION_COMPANY_NAME', | 49 'IDS_ABOUT_VERSION_COMPANY_NAME', |
| 50 'IDS_APP_SHORTCUTS_SUBDIR_NAME', | 50 'IDS_APP_SHORTCUTS_SUBDIR_NAME', |
| 51 'IDS_APP_SHORTCUTS_SUBDIR_NAME_BETA', |
| 51 'IDS_APP_SHORTCUTS_SUBDIR_NAME_CANARY', | 52 'IDS_APP_SHORTCUTS_SUBDIR_NAME_CANARY', |
| 53 'IDS_APP_SHORTCUTS_SUBDIR_NAME_DEV', |
| 52 'IDS_INBOUND_MDNS_RULE_DESCRIPTION', | 54 'IDS_INBOUND_MDNS_RULE_DESCRIPTION', |
| 55 'IDS_INBOUND_MDNS_RULE_DESCRIPTION_BETA', |
| 53 'IDS_INBOUND_MDNS_RULE_DESCRIPTION_CANARY', | 56 'IDS_INBOUND_MDNS_RULE_DESCRIPTION_CANARY', |
| 57 'IDS_INBOUND_MDNS_RULE_DESCRIPTION_DEV', |
| 54 'IDS_INBOUND_MDNS_RULE_NAME', | 58 'IDS_INBOUND_MDNS_RULE_NAME', |
| 59 'IDS_INBOUND_MDNS_RULE_NAME_BETA', |
| 55 'IDS_INBOUND_MDNS_RULE_NAME_CANARY', | 60 'IDS_INBOUND_MDNS_RULE_NAME_CANARY', |
| 61 'IDS_INBOUND_MDNS_RULE_NAME_DEV', |
| 56 'IDS_INSTALL_EXISTING_VERSION_LAUNCHED', | 62 'IDS_INSTALL_EXISTING_VERSION_LAUNCHED', |
| 57 'IDS_INSTALL_FAILED', | 63 'IDS_INSTALL_FAILED', |
| 58 'IDS_INSTALL_HIGHER_VERSION', | 64 'IDS_INSTALL_HIGHER_VERSION', |
| 59 'IDS_INSTALL_INSUFFICIENT_RIGHTS', | 65 'IDS_INSTALL_INSUFFICIENT_RIGHTS', |
| 60 'IDS_INSTALL_INVALID_ARCHIVE', | 66 'IDS_INSTALL_INVALID_ARCHIVE', |
| 61 'IDS_INSTALL_OS_ERROR', | 67 'IDS_INSTALL_OS_ERROR', |
| 62 'IDS_INSTALL_OS_NOT_SUPPORTED', | 68 'IDS_INSTALL_OS_NOT_SUPPORTED', |
| 63 'IDS_INSTALL_SINGLETON_ACQUISITION_FAILED', | 69 'IDS_INSTALL_SINGLETON_ACQUISITION_FAILED', |
| 64 'IDS_INSTALL_TEMP_DIR_FAILED', | 70 'IDS_INSTALL_TEMP_DIR_FAILED', |
| 65 'IDS_INSTALL_UNCOMPRESSION_FAILED', | 71 'IDS_INSTALL_UNCOMPRESSION_FAILED', |
| 66 'IDS_PRODUCT_DESCRIPTION', | 72 'IDS_PRODUCT_DESCRIPTION', |
| 67 'IDS_PRODUCT_NAME', | 73 'IDS_PRODUCT_NAME', |
| 68 'IDS_SAME_VERSION_REPAIR_FAILED', | 74 'IDS_SAME_VERSION_REPAIR_FAILED', |
| 69 'IDS_SETUP_PATCH_FAILED', | 75 'IDS_SETUP_PATCH_FAILED', |
| 76 'IDS_SHORTCUT_NAME_BETA', |
| 77 'IDS_SHORTCUT_NAME_DEV', |
| 70 'IDS_SHORTCUT_NEW_WINDOW', | 78 'IDS_SHORTCUT_NEW_WINDOW', |
| 71 'IDS_SHORTCUT_TOOLTIP', | 79 'IDS_SHORTCUT_TOOLTIP', |
| 72 'IDS_SXS_SHORTCUT_NAME', | 80 'IDS_SXS_SHORTCUT_NAME', |
| 73 ] | 81 ] |
| 74 | 82 |
| 75 # Certain strings are conditional on a brand's install mode (see | 83 # Certain strings are conditional on a brand's install mode (see |
| 76 # chrome/install_static/install_modes.h for details). This allows | 84 # chrome/install_static/install_modes.h for details). This allows |
| 77 # installer::GetLocalizedString to return a resource specific to the current | 85 # installer::GetLocalizedString to return a resource specific to the current |
| 78 # install mode at runtime (e.g., "Google Chrome SxS" as IDS_SHORTCUT_NAME for | 86 # install mode at runtime (e.g., "Google Chrome SxS" as IDS_SHORTCUT_NAME for |
| 79 # the localized shortcut name for Google Chrome's canary channel). | 87 # the localized shortcut name for Google Chrome's canary channel). |
| (...skipping 19 matching lines...) Expand all Loading... |
| 99 # 'resource_id_1' names an existing string ID. All calls to | 107 # 'resource_id_1' names an existing string ID. All calls to |
| 100 # installer::GetLocalizedString with this string ID will map to the | 108 # installer::GetLocalizedString with this string ID will map to the |
| 101 # mode-specific string. | 109 # mode-specific string. |
| 102 # | 110 # |
| 103 # Note: Update the test expectations in GetBaseMessageIdForMode.GoogleStringIds | 111 # Note: Update the test expectations in GetBaseMessageIdForMode.GoogleStringIds |
| 104 # when adding to/modifying this structure. | 112 # when adding to/modifying this structure. |
| 105 MODE_SPECIFIC_STRINGS = { | 113 MODE_SPECIFIC_STRINGS = { |
| 106 'IDS_APP_SHORTCUTS_SUBDIR_NAME': { | 114 'IDS_APP_SHORTCUTS_SUBDIR_NAME': { |
| 107 'google_chrome': [ | 115 'google_chrome': [ |
| 108 'IDS_APP_SHORTCUTS_SUBDIR_NAME', | 116 'IDS_APP_SHORTCUTS_SUBDIR_NAME', |
| 117 'IDS_APP_SHORTCUTS_SUBDIR_NAME_BETA', |
| 118 'IDS_APP_SHORTCUTS_SUBDIR_NAME_DEV', |
| 109 'IDS_APP_SHORTCUTS_SUBDIR_NAME_CANARY', | 119 'IDS_APP_SHORTCUTS_SUBDIR_NAME_CANARY', |
| 110 ], | 120 ], |
| 111 'chromium': [ | 121 'chromium': [ |
| 112 'IDS_APP_SHORTCUTS_SUBDIR_NAME', | 122 'IDS_APP_SHORTCUTS_SUBDIR_NAME', |
| 113 ], | 123 ], |
| 114 }, | 124 }, |
| 115 'IDS_INBOUND_MDNS_RULE_DESCRIPTION': { | 125 'IDS_INBOUND_MDNS_RULE_DESCRIPTION': { |
| 116 'google_chrome': [ | 126 'google_chrome': [ |
| 117 'IDS_INBOUND_MDNS_RULE_DESCRIPTION', | 127 'IDS_INBOUND_MDNS_RULE_DESCRIPTION', |
| 128 'IDS_INBOUND_MDNS_RULE_DESCRIPTION_BETA', |
| 129 'IDS_INBOUND_MDNS_RULE_DESCRIPTION_DEV', |
| 118 'IDS_INBOUND_MDNS_RULE_DESCRIPTION_CANARY', | 130 'IDS_INBOUND_MDNS_RULE_DESCRIPTION_CANARY', |
| 119 ], | 131 ], |
| 120 'chromium': [ | 132 'chromium': [ |
| 121 'IDS_INBOUND_MDNS_RULE_DESCRIPTION', | 133 'IDS_INBOUND_MDNS_RULE_DESCRIPTION', |
| 122 ], | 134 ], |
| 123 }, | 135 }, |
| 124 'IDS_INBOUND_MDNS_RULE_NAME': { | 136 'IDS_INBOUND_MDNS_RULE_NAME': { |
| 125 'google_chrome': [ | 137 'google_chrome': [ |
| 126 'IDS_INBOUND_MDNS_RULE_NAME', | 138 'IDS_INBOUND_MDNS_RULE_NAME', |
| 139 'IDS_INBOUND_MDNS_RULE_NAME_BETA', |
| 140 'IDS_INBOUND_MDNS_RULE_NAME_DEV', |
| 127 'IDS_INBOUND_MDNS_RULE_NAME_CANARY', | 141 'IDS_INBOUND_MDNS_RULE_NAME_CANARY', |
| 128 ], | 142 ], |
| 129 'chromium': [ | 143 'chromium': [ |
| 130 'IDS_INBOUND_MDNS_RULE_NAME', | 144 'IDS_INBOUND_MDNS_RULE_NAME', |
| 131 ], | 145 ], |
| 132 }, | 146 }, |
| 133 # In contrast to the strings above, this one (IDS_PRODUCT_NAME) is used | 147 # In contrast to the strings above, this one (IDS_PRODUCT_NAME) is used |
| 134 # throughout Chrome in mode-independent contexts. Within the installer (the | 148 # throughout Chrome in mode-independent contexts. Within the installer (the |
| 135 # place where this mapping matters), it is only used for mode-specific strings | 149 # place where this mapping matters), it is only used for mode-specific strings |
| 136 # such as the name of Chrome's shortcut. | 150 # such as the name of Chrome's shortcut. |
| 137 'IDS_PRODUCT_NAME': { | 151 'IDS_PRODUCT_NAME': { |
| 138 'google_chrome': [ | 152 'google_chrome': [ |
| 139 'IDS_PRODUCT_NAME', | 153 'IDS_PRODUCT_NAME', |
| 154 'IDS_SHORTCUT_NAME_BETA', |
| 155 'IDS_SHORTCUT_NAME_DEV', |
| 140 'IDS_SXS_SHORTCUT_NAME', | 156 'IDS_SXS_SHORTCUT_NAME', |
| 141 ], | 157 ], |
| 142 'chromium': [ | 158 'chromium': [ |
| 143 'IDS_PRODUCT_NAME', | 159 'IDS_PRODUCT_NAME', |
| 144 ], | 160 ], |
| 145 }, | 161 }, |
| 146 } | 162 } |
| 147 # Note: Update the test expectations in GetBaseMessageIdForMode.GoogleStringIds | 163 # Note: Update the test expectations in GetBaseMessageIdForMode.GoogleStringIds |
| 148 # when adding to/modifying the above structure. | 164 # when adding to/modifying the above structure. |
| 149 | 165 |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 | 529 |
| 514 | 530 |
| 515 def main(): | 531 def main(): |
| 516 args = ParseCommandLine() | 532 args = ParseCommandLine() |
| 517 StringRcMaker(args.name, args.inputs, args.outdir, args.brand).MakeFiles() | 533 StringRcMaker(args.name, args.inputs, args.outdir, args.brand).MakeFiles() |
| 518 return 0 | 534 return 0 |
| 519 | 535 |
| 520 | 536 |
| 521 if '__main__' == __name__: | 537 if '__main__' == __name__: |
| 522 sys.exit(main()) | 538 sys.exit(main()) |
| OLD | NEW |