diff options
author | mark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-04 14:42:19 +0000 |
---|---|---|
committer | mark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-04 14:42:19 +0000 |
commit | e2260edd7101ad9748831e1414db1289dd911009 (patch) | |
tree | aad166db112052be232ad53c9c9bdb8ae9b7f6b3 | |
parent | c710a5649efa1c8d33f4c2ecc52d7e9300a37fe2 (diff) | |
download | chromium_src-e2260edd7101ad9748831e1414db1289dd911009.zip chromium_src-e2260edd7101ad9748831e1414db1289dd911009.tar.gz chromium_src-e2260edd7101ad9748831e1414db1289dd911009.tar.bz2 |
EN, mf, DO YOU SPEAK IT?
No more symbolic links in the .app. Except for the ones that codesign adds.
The en_US.lproj directory should not exist, there should be only en.lproj.
Formerly, there was a symbolic link from en.lproj to en_US.lproj.
BUG=25578, 19165
TEST= - find C.app -name en_US.lproj should return nothing.
- find C.app -name en.lproj should show en.lproj in C.app,
C F.framework, and C H.app.
- find C.app -type l should return nothing, however, on a signed build,
it will still show symbolic links for CodeResources.
- Say "What" again. Say "What" again. I dare you. I double-dare you.
- With English or U.S. English as the top or only choices in the
International (10.5) or Language & Text (10.6) system preference
pane's Language tab, the localized language should be English.
- In this configuration, the Accept-Language header field should be
"en-US,en;q=0.8". See http://whatsmyuseragent.com/ and look for
HTTP_ACCEPT_LANGUAGE.
Review URL: http://codereview.chromium.org/345057
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30955 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/app/app-Info.plist | 2 | ||||
-rw-r--r-- | chrome/app/framework-Info.plist | 2 | ||||
-rw-r--r-- | chrome/app/helper-Info.plist | 2 | ||||
-rwxr-xr-x | chrome/chrome.gyp | 52 | ||||
-rwxr-xr-x | chrome/tools/build/apply_locales.py | 8 | ||||
-rwxr-xr-x | chrome/tools/build/mac/symlink_lprojs | 28 | ||||
-rwxr-xr-x | chrome/tools/build/mac/transition_lprojs | 22 | ||||
-rwxr-xr-x | chrome/tools/build/repack_locales.py | 5 | ||||
-rw-r--r-- | chrome/tools/mac_helpers/infoplist_strings_util.mm | 15 |
9 files changed, 84 insertions, 52 deletions
diff --git a/chrome/app/app-Info.plist b/chrome/app/app-Info.plist index b0784d7..f3f53b6 100644 --- a/chrome/app/app-Info.plist +++ b/chrome/app/app-Info.plist @@ -3,7 +3,7 @@ <plist version="1.0"> <dict> <key>CFBundleDevelopmentRegion</key> - <string>en-US</string> + <string>en</string> <key>CFBundleDisplayName</key> <string>${EXECUTABLE_NAME}</string> <key>CFBundleDocumentTypes</key> diff --git a/chrome/app/framework-Info.plist b/chrome/app/framework-Info.plist index 9cfe1b0..f3b7fc7 100644 --- a/chrome/app/framework-Info.plist +++ b/chrome/app/framework-Info.plist @@ -3,7 +3,7 @@ <plist version="1.0"> <dict> <key>CFBundleDevelopmentRegion</key> - <string>en-US</string> + <string>en</string> <key>CFBundleExecutable</key> <string>${EXECUTABLE_NAME}</string> <key>CFBundleIdentifier</key> diff --git a/chrome/app/helper-Info.plist b/chrome/app/helper-Info.plist index 100e5a3..3e057b1 100644 --- a/chrome/app/helper-Info.plist +++ b/chrome/app/helper-Info.plist @@ -3,7 +3,7 @@ <plist version="1.0"> <dict> <key>CFBundleDevelopmentRegion</key> - <string>en-US</string> + <string>en</string> <key>CFBundleDisplayName</key> <string>${EXECUTABLE_NAME}</string> <key>CFBundleExecutable</key> diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index c1fe430..6aa894d 100755 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -149,7 +149,9 @@ },], ['OS=="mac"', { 'tweak_info_plist_path': 'tools/build/mac/tweak_info_plist', - 'symlink_lprojs_path': 'tools/build/mac/symlink_lprojs', + # TODO(mark): Remove after November 17, 2009, allowing two weeks for + # the transition. + 'transition_lprojs_path': 'tools/build/mac/transition_lprojs', 'nacl_defines': [ 'NACL_WINDOWS=0', 'NACL_LINUX=0', @@ -3659,6 +3661,18 @@ ], 'actions': [ { + # Clean up the old .lproj structure, where English was in + # en_US.lproj, and en.lproj was a symbolic link. This must run + # before the "Generating InfoPlist.strings files" action. + # + # TODO(mark): Remove after November 17, 2009, allowing two weeks + # for the transition. + 'action_name': 'Temporary .lproj transition', + 'action': ['<(transition_lprojs_path)'], + 'inputs': [], # Always run. + 'outputs': [], + }, + { # Generate the InfoPlist.strings file 'action_name': 'Generating InfoPlist.strings files', 'variables': { @@ -3733,10 +3747,6 @@ '<(mac_bundle_id)'], }, { - 'postbuild_name': 'Make .lproj links', - 'action': ['<(symlink_lprojs_path)'], - }, - { 'postbuild_name': 'Clean up old versions', 'action': [ 'tools/build/mac/clean_up_old_versions', @@ -5748,6 +5758,18 @@ 'repack_path': '../tools/data_pack/repack.py', }, 'actions': [ + { + # Clean up the old .lproj structure, where English was in + # en_US.lproj, and en.lproj was a symbolic link. This must + # run before the "repack_locales" action. + # + # TODO(mark): Remove after November 17, 2009, allowing two + # weeks for the transition. + 'action_name': 'Temporary .lproj transition', + 'action': ['<(transition_lprojs_path)'], + 'inputs': [], # Always run. + 'outputs': [], + }, # TODO(mark): These actions are duplicated for Linux and # FreeBSD in the chrome target. Can they be unified? { @@ -5825,10 +5847,6 @@ '<(mac_bundle_id)'], }, { - 'postbuild_name': 'Make .lproj links', - 'action': ['<(symlink_lprojs_path)'], - }, - { 'postbuild_name': 'Symlink Libraries', 'action': [ 'ln', @@ -5977,6 +5995,18 @@ ], 'actions': [ { + # Clean up the old .lproj structure, where English was in + # en_US.lproj, and en.lproj was a symbolic link. This must run + # before the "Generating InfoPlist.strings files" action. + # + # TODO(mark): Remove after November 17, 2009, allowing two weeks + # for the transition. + 'action_name': 'Temporary .lproj transition', + 'action': ['<(transition_lprojs_path)'], + 'inputs': [], # Always run. + 'outputs': [], + }, + { # Generate the InfoPlist.strings file 'action_name': 'Generating InfoPlist.strings files', 'variables': { @@ -6049,10 +6079,6 @@ '<(branding)', '<(mac_bundle_id)'], }, - { - 'postbuild_name': 'Make .lproj links', - 'action': ['<(symlink_lprojs_path)'], - }, ], 'conditions': [ ['mac_breakpad==1', { diff --git a/chrome/tools/build/apply_locales.py b/chrome/tools/build/apply_locales.py index fc8c4af..6af7280 100755 --- a/chrome/tools/build/apply_locales.py +++ b/chrome/tools/build/apply_locales.py @@ -14,7 +14,8 @@ def main(argv): usage = 'usage: %s [options ...] format_string locale_list' parser.set_usage(usage.replace('%s', '%prog')) parser.add_option('-d', dest='dash_to_underscore', action="store_true", - default=False, help='map "-" to "_" in locales') + default=False, + help='map "en-US" to "en" and "-" to "_" in locales') (options, arglist) = parser.parse_args(argv) @@ -28,8 +29,11 @@ def main(argv): results = [] for locale in locales: # For Cocoa to find the locale at runtime, it needs to use '_' instead - # of '-'. (http://crbug.com/20441) + # of '-' (http://crbug.com/20441). Also, 'en-US' should be represented + # simply as 'en' (http://crbug.com/19165, http://crbug.com/25578). if options.dash_to_underscore: + if locale == 'en-US': + locale = 'en' locale = locale.replace('-', '_') results.append(str_template.replace('ZZLOCALE', locale)) diff --git a/chrome/tools/build/mac/symlink_lprojs b/chrome/tools/build/mac/symlink_lprojs deleted file mode 100755 index 6fffcdf..0000000 --- a/chrome/tools/build/mac/symlink_lprojs +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh - -# Copyright (c) 2009 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# This script is intended to run from a "postbuild" action from within Xcode. -# It will create any symlinks needed to sync up what comes from the GRIT files -# with what Cocoa would like. - -set -e - -# Working in the resources directory -cd "${BUILT_PRODUCTS_DIR}/${CONTENTS_FOLDER_PATH}/Resources" - -# Provide an link for en.lproj that points to en_US.lproj. - -# The standard OS language list includes English (en) and not a specific -# "flavor" such as U.S. English (en_US). When checking for a language match, -# the OS will remove subtags if no exact match is found, so that en will be -# used if the user's preferred language list only contains British English -# (en_GB) and no specific en_GB translation is available. -# -# To ensure that users with the default language list, which contains English -# without any regional subtag, as well as users with a specific variant of -# English with a regional subtag, will have access to an English-localized -# application, a symbolic link from en.lproj to en_US.lproj is provided. -ln -fhs "en_US.lproj" "en.lproj" diff --git a/chrome/tools/build/mac/transition_lprojs b/chrome/tools/build/mac/transition_lprojs new file mode 100755 index 0000000..40ccb44 --- /dev/null +++ b/chrome/tools/build/mac/transition_lprojs @@ -0,0 +1,22 @@ +#!/bin/sh + +# Copyright (c) 2009 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# Clean up the old .lproj structure, where English was in en_US.lproj, and +# en.lproj was a symbolic link. +# +# TODO(mark): Remove after November 17, 2009, allowing two weeks for the +# transition. + +RESOURCES_DIR="${BUILT_PRODUCTS_DIR}/${CONTENTS_FOLDER_PATH}/Resources" + +# Always dump en_US.lproj. +rm -rf "${RESOURCES_DIR}/en_US.lproj" + +# Only dump en.lproj if it's a symbolic link. If it's a directory, then the +# transition has already been performed. +if [ -L "${RESOURCES_DIR}/en.lproj" ] ; then + rm -f "${RESOURCES_DIR}/en.lproj" +fi diff --git a/chrome/tools/build/repack_locales.py b/chrome/tools/build/repack_locales.py index fc55b2d..8124c38 100755 --- a/chrome/tools/build/repack_locales.py +++ b/chrome/tools/build/repack_locales.py @@ -37,7 +37,10 @@ def calc_output(locale): #e.g. '<(INTERMEDIATE_DIR)/repack/da.pak', if sys.platform in ('darwin',): # For Cocoa to find the locale at runtime, it needs to use '_' instead - # of '-'. (http://crbug.com/20441) + # of '-' (http://crbug.com/20441). Also, 'en-US' should be represented + # simply as 'en' (http://crbug.com/19165, http://crbug.com/25578). + if locale == 'en-US': + locale = 'en' return '%s/repack/%s.lproj/locale.pak' % (INT_DIR, locale.replace('-', '_')) else: return '%s/repack/%s.pak' % (INT_DIR, locale) diff --git a/chrome/tools/mac_helpers/infoplist_strings_util.mm b/chrome/tools/mac_helpers/infoplist_strings_util.mm index d5249bf..474e587 100644 --- a/chrome/tools/mac_helpers/infoplist_strings_util.mm +++ b/chrome/tools/mac_helpers/infoplist_strings_util.mm @@ -266,12 +266,17 @@ int main(int argc, char* const argv[]) { exit(1); } - // Make sure the lproj we write to exists - NSString *lproj_name = [NSString stringWithFormat:@"%s.lproj", cur_lang]; // For Cocoa to find the locale at runtime, it needs to use '_' instead of - // '-'. (http://crbug.com/20441) - lproj_name = [lproj_name stringByReplacingOccurrencesOfString:@"-" - withString:@"_"]; + // '-' (http://crbug.com/20441). Also, 'en-US' should be represented + // simply as 'en' (http://crbug.com/19165, http://crbug.com/25578). + NSString* cur_lang_ns = [NSString stringWithUTF8String:cur_lang]; + if ([cur_lang_ns isEqualToString:@"en-US"]) { + cur_lang_ns = @"en"; + } + cur_lang_ns = [cur_lang_ns stringByReplacingOccurrencesOfString:@"-" + withString:@"_"]; + // Make sure the lproj we write to exists + NSString *lproj_name = [NSString stringWithFormat:@"%@.lproj", cur_lang_ns]; NSString *output_path = [[NSString stringWithUTF8String:output_dir] stringByAppendingPathComponent:lproj_name]; |