summaryrefslogtreecommitdiffstats
path: root/chrome/tools
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/tools')
-rwxr-xr-xchrome/tools/build/apply_locales.py20
-rwxr-xr-xchrome/tools/build/repack_locales.py4
-rw-r--r--chrome/tools/mac_helpers/infoplist_strings_util.mm8
3 files changed, 26 insertions, 6 deletions
diff --git a/chrome/tools/build/apply_locales.py b/chrome/tools/build/apply_locales.py
index c7b0861..fc8c4af 100755
--- a/chrome/tools/build/apply_locales.py
+++ b/chrome/tools/build/apply_locales.py
@@ -6,17 +6,31 @@
# TODO: remove this script when GYP has for loops
import sys
+import optparse
def main(argv):
- if len(argv) < 3:
+
+ parser = optparse.OptionParser()
+ 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')
+
+ (options, arglist) = parser.parse_args(argv)
+
+ if len(arglist) < 3:
print 'ERROR: need string and list of locales'
return 1
- str_template = argv[1]
- locales = argv[2:]
+ str_template = arglist[1]
+ locales = arglist[2:]
results = []
for locale in locales:
+ # For Cocoa to find the locale at runtime, it needs to use '_' instead
+ # of '-'. (http://crbug.com/20441)
+ if options.dash_to_underscore:
+ locale = locale.replace('-', '_')
results.append(str_template.replace('ZZLOCALE', locale))
# Quote each element so filename spaces don't mess up GYP's attempt to parse
diff --git a/chrome/tools/build/repack_locales.py b/chrome/tools/build/repack_locales.py
index 7e05e81..fc55b2d 100755
--- a/chrome/tools/build/repack_locales.py
+++ b/chrome/tools/build/repack_locales.py
@@ -36,7 +36,9 @@ def calc_output(locale):
"""Determine the file that will be generated for the given locale."""
#e.g. '<(INTERMEDIATE_DIR)/repack/da.pak',
if sys.platform in ('darwin',):
- return '%s/repack/%s.lproj/locale.pak' % (INT_DIR, locale)
+ # For Cocoa to find the locale at runtime, it needs to use '_' instead
+ # of '-'. (http://crbug.com/20441)
+ 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 70fbca6..f2bbf7a 100644
--- a/chrome/tools/mac_helpers/infoplist_strings_util.mm
+++ b/chrome/tools/mac_helpers/infoplist_strings_util.mm
@@ -267,10 +267,14 @@ int main(int argc, char* const argv[]) {
}
// 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:@"_"];
NSString *output_path =
[[NSString stringWithUTF8String:output_dir]
- stringByAppendingPathComponent:
- [NSString stringWithFormat:@"%s.lproj", cur_lang]];
+ stringByAppendingPathComponent:lproj_name];
NSError* error = nil;
if (![fm fileExistsAtPath:output_path] &&
![fm createDirectoryAtPath:output_path