summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorkuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-21 00:25:57 +0000
committerkuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-21 00:25:57 +0000
commitc55fd9484f10cb72736e0a6688f7ed0db5435af8 (patch)
tree2b551606dc1e71d8cd98932cdf94a5c9df4121b5 /chrome
parent31a4334b34b8a8bfe4888f5a7577a4cd85035fac (diff)
downloadchromium_src-c55fd9484f10cb72736e0a6688f7ed0db5435af8.zip
chromium_src-c55fd9484f10cb72736e0a6688f7ed0db5435af8.tar.gz
chromium_src-c55fd9484f10cb72736e0a6688f7ed0db5435af8.tar.bz2
Recommit r36640 "Choose right installer strings based on branding."
Review URL: http://codereview.chromium.org/553037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36706 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/installer/installer.gyp5
-rw-r--r--chrome/installer/util/l10n_string_util.cc10
-rwxr-xr-xchrome/installer/util/prebuild/create_string_rc.py19
3 files changed, 27 insertions, 7 deletions
diff --git a/chrome/installer/installer.gyp b/chrome/installer/installer.gyp
index 28b46826..c75c7db 100644
--- a/chrome/installer/installer.gyp
+++ b/chrome/installer/installer.gyp
@@ -124,12 +124,13 @@
],
'action': ['python',
'util/prebuild/create_string_rc.py',
- '<(SHARED_INTERMEDIATE_DIR)/installer_util_strings'],
+ '<(SHARED_INTERMEDIATE_DIR)/installer_util_strings',
+ '<(branding)',],
'message': 'Generating resources from <(RULE_INPUT_PATH)',
},
],
'sources': [
- '../app/generated_resources.grd',
+ '../app/chromium_strings.grd',
],
'direct_dependent_settings': {
'include_dirs': [
diff --git a/chrome/installer/util/l10n_string_util.cc b/chrome/installer/util/l10n_string_util.cc
index 3269516..341c34c 100644
--- a/chrome/installer/util/l10n_string_util.cc
+++ b/chrome/installer/util/l10n_string_util.cc
@@ -79,6 +79,7 @@ std::wstring GetSystemLanguage() {
int GetLanguageOffset(const std::wstring& language) {
static std::map<std::wstring, int> offset_map;
if (offset_map.empty()) {
+#if defined(GOOGLE_CHROME_BUILD)
offset_map[L"ar"] = IDS_L10N_OFFSET_AR;
offset_map[L"bg"] = IDS_L10N_OFFSET_BG;
offset_map[L"bn"] = IDS_L10N_OFFSET_BN;
@@ -136,6 +137,9 @@ int GetLanguageOffset(const std::wstring& language) {
offset_map[L"vi"] = IDS_L10N_OFFSET_VI;
offset_map[L"zh-cn"] = IDS_L10N_OFFSET_ZH_CN;
offset_map[L"zh-tw"] = IDS_L10N_OFFSET_ZH_TW;
+#else // GOOGLE_CHROME_BUILD not defined
+ offset_map[L"en-us"] = IDS_L10N_OFFSET_EN_US;
+#endif // if defined(GOOGLE_CHROME_BUILD)
}
std::map<std::wstring, int>::iterator it = offset_map.find(
@@ -143,7 +147,9 @@ int GetLanguageOffset(const std::wstring& language) {
if (it != offset_map.end())
return it->second;
+#if defined(GOOGLE_CHROME_BUILD)
NOTREACHED() << "unknown system language-country";
+#endif // if defined(GOOGLE_CHROME_BUILD)
// Fallback on the en-US offset just in case.
return IDS_L10N_OFFSET_EN_US;
@@ -181,6 +187,7 @@ std::wstring GetLocalizedEulaResource() {
static std::map<int, wchar_t*> html_map;
if (html_map.empty()) {
+#if defined(GOOGLE_CHROME_BUILD)
html_map[IDS_L10N_OFFSET_AR] = L"IDR_OEMPG_AR.HTML";
html_map[IDS_L10N_OFFSET_BG] = L"IDR_OEMPG_BG.HTML";
html_map[IDS_L10N_OFFSET_CA] = L"IDR_OEMPG_CA.HTML";
@@ -222,6 +229,9 @@ std::wstring GetLocalizedEulaResource() {
html_map[IDS_L10N_OFFSET_VI] = L"IDR_OEMPG_VI.HTML";
html_map[IDS_L10N_OFFSET_ZH_CN] = L"IDR_OEMPG_ZH_CN.HTML";
html_map[IDS_L10N_OFFSET_ZH_TW] = L"IDR_OEMPG_ZH_TW.HTML";
+#else // GOOGLE_CHROME_BUILD not defined
+ html_map[IDS_L10N_OFFSET_EN_US] = L"IDR_OEMPG_EN.HTML";
+#endif // if defined(GOOGLE_CHROME_BUILD)
}
std::map<int, wchar_t*>::iterator it = html_map.find(
diff --git a/chrome/installer/util/prebuild/create_string_rc.py b/chrome/installer/util/prebuild/create_string_rc.py
index 5433029..5ebff1b 100755
--- a/chrome/installer/util/prebuild/create_string_rc.py
+++ b/chrome/installer/util/prebuild/create_string_rc.py
@@ -79,16 +79,21 @@ class TranslationStruct:
return cmp(self.resource_id_str, other.resource_id_str)
-def CollectTranslatedStrings():
+def CollectTranslatedStrings(branding):
"""Collects all the translations for all the strings specified by kStringIds.
Returns a list of tuples of (string_id, language, translated string). The
list is sorted by language codes."""
+ strings_file = 'app/chromium_strings.grd'
+ translation_files = 'chromium_strings*.xtb'
+ if branding == 'Chrome':
+ strings_file = 'app/google_chrome_strings.grd'
+ translation_files = 'google_chrome_strings*.xtb'
kGeneratedResourcesPath = os.path.join(path_utils.ScriptDir(), '..', '..',
- '..', 'app/google_chrome_strings.grd')
+ '..', strings_file)
kTranslationDirectory = os.path.join(path_utils.ScriptDir(), '..', '..',
'..', 'app', 'resources')
kTranslationFiles = glob.glob(os.path.join(kTranslationDirectory,
- 'google_chrome_strings*.xtb'))
+ translation_files))
# Get the strings out of generated_resources.grd.
dom = minidom.parse(kGeneratedResourcesPath)
@@ -193,13 +198,17 @@ def WriteHeaderFile(translated_strings, out_filename):
outfile.close()
def main(argv):
- translated_strings = CollectTranslatedStrings()
+ branding = ''
+ if (len(sys.argv) > 2):
+ branding = argv[2]
+ translated_strings = CollectTranslatedStrings(branding)
kFilebase = os.path.join(argv[1], 'installer_util_strings')
WriteRCFile(translated_strings, kFilebase)
WriteHeaderFile(translated_strings, kFilebase)
if '__main__' == __name__:
if len(sys.argv) < 2:
- print 'Usage:\n %s <output_directory>' % sys.argv[0]
+ print 'Usage:\n %s <output_directory> [branding]' % sys.argv[0]
sys.exit(1)
+ # Use optparse to parse command line flags.
main(sys.argv)