Skip to content

Commit

Permalink
fixed a bug with region-specific locales (zh_CN, zh_TW, etc).
Browse files Browse the repository at this point in the history
  • Loading branch information
toolness committed Mar 13, 2012
1 parent c691e07 commit f677d13
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions vendor/localization.py
Expand Up @@ -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])
))
Expand All @@ -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"
Expand All @@ -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()
Expand Down

0 comments on commit f677d13

Please sign in to comment.