Permalink
Browse files

fixed a bug with region-specific locales (zh_CN, zh_TW, etc).

  • Loading branch information...
toolness committed Mar 13, 2012
1 parent c691e07 commit f677d13c9595d62b0e68f8943c446d8e8adb692a
Showing with 5 additions and 2 deletions.
  1. +5 −2 vendor/localization.py
View
@@ -15,7 +15,7 @@ def process_locale_json(data):
for locale in data:
for scope in data[locale]:
lines.append("jQuery.localization.extend(%s, %s, %s);" % (
- json.dumps(locale),
+ json.dumps(hyphenate(locale)),
json.dumps(scope),
json.dumps(data[locale][scope])
))
@@ -42,6 +42,9 @@ def locale_exists(locale, dirname, domain):
'%s.po' % domain)
return os.path.exists(pofile)
+def hyphenate(locale):
+ return locale.replace('_', '-')
+
def compilemessages(json_dir, js_locale_dir, locale_dir, locale_domain,
default_locale):
"convert message files into binary and JS formats"
@@ -56,7 +59,7 @@ def compilemessages(json_dir, js_locale_dir, locale_dir, locale_domain,
locale_domain])
locales = found_locales + [default_locale]
for locale in locales:
- nice_locale = locale.replace('_', '-')
+ nice_locale = hyphenate(locale)
print "processing localization '%s'" % nice_locale
if locale == default_locale:
trans = gettext.NullTranslations()

0 comments on commit f677d13

Please sign in to comment.