diff options
author | grt@chromium.org <grt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-02 13:39:33 +0000 |
---|---|---|
committer | grt@chromium.org <grt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-02 13:39:33 +0000 |
commit | d4ae33bd4278e7fc279695319d9454141740191e (patch) | |
tree | 76814682d5a76d6d48368ea6f8f97706e4ba5d51 | |
parent | f33c522f5bbcb2defe6a446404a7f269780953a3 (diff) | |
download | chromium_src-d4ae33bd4278e7fc279695319d9454141740191e.zip chromium_src-d4ae33bd4278e7fc279695319d9454141740191e.tar.gz chromium_src-d4ae33bd4278e7fc279695319d9454141740191e.tar.bz2 |
Fix sorting of the installer strings .h and .rc files. Resources that were substrings of others (IDS_INSTALL_HIGHER_VERSION and IDS_INSTALL_HIGHER_VERSION_CF, for example) were being sorted incorrectly. Now they aren't.
As a bonus, installer_util_strings now depends on create_string_py, so changes to the scipt no longer require a clobber. Yay
BUG=73884
TEST=build installer_util_strings then look at the generated .h and .rc files and notice that they are sorted properly
Review URL: http://codereview.chromium.org/6594108
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76534 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/chrome_installer.gypi | 6 | ||||
-rwxr-xr-x | chrome/installer/util/prebuild/create_string_rc.py | 13 |
2 files changed, 13 insertions, 6 deletions
diff --git a/chrome/chrome_installer.gypi b/chrome/chrome_installer.gypi index d566ef9..573d209d 100644 --- a/chrome/chrome_installer.gypi +++ b/chrome/chrome_installer.gypi @@ -123,7 +123,11 @@ { 'rule_name': 'installer_util_strings', 'extension': 'grd', + 'variables': { + 'create_string_rc_py' : 'installer/util/prebuild/create_string_rc.py', + }, 'inputs': [ + '<(create_string_rc_py)', '<(RULE_INPUT_PATH)', ], 'outputs': [ @@ -134,7 +138,7 @@ '<(SHARED_INTERMEDIATE_DIR)/installer_util_strings/installer_util_strings.h', ], 'action': ['python', - 'installer/util/prebuild/create_string_rc.py', + '<(create_string_rc_py)', '<(SHARED_INTERMEDIATE_DIR)/installer_util_strings', '<(branding)',], 'message': 'Generating resources from <(RULE_INPUT_PATH)', diff --git a/chrome/installer/util/prebuild/create_string_rc.py b/chrome/installer/util/prebuild/create_string_rc.py index cf081e1..187e22d 100755 --- a/chrome/installer/util/prebuild/create_string_rc.py +++ b/chrome/installer/util/prebuild/create_string_rc.py @@ -85,7 +85,8 @@ class TranslationStruct: def __cmp__(self, other): """Allow TranslationStructs to be sorted by id.""" - return cmp(self.resource_id_str, other.resource_id_str) + id_result = cmp(self.resource_id_str, other.resource_id_str) + return cmp(self.language, other.language) if id_result == 0 else id_result def CollectTranslatedStrings(branding): @@ -124,7 +125,7 @@ def CollectTranslatedStrings(branding): # have a .xtb file. translated_strings = [] for string_id, message_text in zip(kStringIds, message_texts): - translated_strings.append(TranslationStruct(string_id + '_EN_US', + translated_strings.append(TranslationStruct(string_id, 'EN_US', message_text)) @@ -144,7 +145,7 @@ def CollectTranslatedStrings(branding): for i, string_id in enumerate(kStringIds): translated_string = translation_nodes.get(translation_ids[i], message_texts[i]) - translated_strings.append(TranslationStruct(string_id + '_' + language, + translated_strings.append(TranslationStruct(string_id, language, translated_string)) @@ -168,7 +169,8 @@ def WriteRCFile(translated_strings, out_filename): translation = (translation_struct.translation.replace('"', '""') .replace('\t', '\\t') .replace('\n', '\\n')) - lines.append(u' %s "%s"\n' % (translation_struct.resource_id_str, + lines.append(u' %s "%s"\n' % (translation_struct.resource_id_str + '_' + + translation_struct.language, translation)) lines.append(kFooterText) outfile = open(out_filename + '.rc', 'wb') @@ -198,7 +200,8 @@ def WriteHeaderFile(translated_strings, out_filename): # Write the resource ids themselves. resource_id = kFirstResourceID for translation_struct in translated_strings: - lines.append('#define %s %s' % (translation_struct.resource_id_str, + lines.append('#define %s %s' % (translation_struct.resource_id_str + '_' + + translation_struct.language, resource_id)) resource_id += 1 |