Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(281)

Side by Side Diff: chrome/installer/util/prebuild/create_string_rc.py

Issue 53077: Magic incatation to have the translated strings appear in the setup.exe resou... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright 2008 Google Inc. All rights reserved. 2 # Copyright 2008 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 'IDS_INSTALL_SYSTEM_LEVEL_EXISTS', 44 'IDS_INSTALL_SYSTEM_LEVEL_EXISTS',
45 'IDS_INSTALL_FAILED', 45 'IDS_INSTALL_FAILED',
46 'IDS_INSTALL_OS_NOT_SUPPORTED', 46 'IDS_INSTALL_OS_NOT_SUPPORTED',
47 'IDS_INSTALL_OS_ERROR', 47 'IDS_INSTALL_OS_ERROR',
48 'IDS_INSTALL_TEMP_DIR_FAILED', 48 'IDS_INSTALL_TEMP_DIR_FAILED',
49 'IDS_INSTALL_UNCOMPRESSION_FAILED', 49 'IDS_INSTALL_UNCOMPRESSION_FAILED',
50 'IDS_INSTALL_INVALID_ARCHIVE', 50 'IDS_INSTALL_INVALID_ARCHIVE',
51 'IDS_INSTALL_INSUFFICIENT_RIGHTS', 51 'IDS_INSTALL_INSUFFICIENT_RIGHTS',
52 'IDS_UNINSTALL_FAILED', 52 'IDS_UNINSTALL_FAILED',
53 'IDS_INSTALL_DIR_IN_USE', 53 'IDS_INSTALL_DIR_IN_USE',
54 'IDS_OEM_MAIN_SHORTCUT_NAME',
55 'IDS_SHORTCUT_TOOLTIP',
54 ] 56 ]
55 57
56 # The ID of the first resource string. 58 # The ID of the first resource string.
57 kFirstResourceID = 1600 59 kFirstResourceID = 1600
58 60
59 class TranslationStruct: 61 class TranslationStruct:
60 """A helper struct that holds information about a single translation.""" 62 """A helper struct that holds information about a single translation."""
61 def __init__(self, resource_id_str, language, translation): 63 def __init__(self, resource_id_str, language, translation):
62 self.resource_id_str = resource_id_str 64 self.resource_id_str = resource_id_str
63 self.language = language 65 self.language = language
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 translated_strings = CollectTranslatedStrings() 187 translated_strings = CollectTranslatedStrings()
186 kFilebase = os.path.join(argv[1], 'installer_util_strings') 188 kFilebase = os.path.join(argv[1], 'installer_util_strings')
187 WriteRCFile(translated_strings, kFilebase) 189 WriteRCFile(translated_strings, kFilebase)
188 WriteHeaderFile(translated_strings, kFilebase) 190 WriteHeaderFile(translated_strings, kFilebase)
189 191
190 if '__main__' == __name__: 192 if '__main__' == __name__:
191 if len(sys.argv) < 2: 193 if len(sys.argv) < 2:
192 print 'Usage:\n %s <output_directory>' % sys.argv[0] 194 print 'Usage:\n %s <output_directory>' % sys.argv[0]
193 sys.exit(1) 195 sys.exit(1)
194 main(sys.argv) 196 main(sys.argv)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698