Skip to content

Commit

Permalink
Don't crash if PO files aren't exactly where we expected them when ge…
Browse files Browse the repository at this point in the history
…nerating translations.
  • Loading branch information
TkTech committed Nov 21, 2016
1 parent 9b5bf5d commit e379f11
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions ckan/lib/i18n.py
Expand Up @@ -381,10 +381,20 @@ def build_js_translations():

# Build translations for each language
for lang in sorted(langs):
po_files = [os.path.join(i18n_dir, lang, u'LC_MESSAGES',
domain + u'.po')
for i18n_dir, domain in i18n_dirs.iteritems()]
po_files = [fn for fn in po_files if os.path.isfile(fn)]
po_files = [
fn for fn in (
os.path.join(
i18n_dir,
lang,
u'LC_MESSAGES',
domain + u'.po'
)
for i18n_dir, domain in i18n_dirs.iteritems()
) if os.path.isfile(fn)
]
if not po_files:
continue

latest = max(os.path.getmtime(fn) for fn in po_files)
dest_file = os.path.join(_JS_TRANSLATIONS_DIR, lang + u'.js')
if os.path.isfile(dest_file) and os.path.getmtime(dest_file) > latest:
Expand Down

0 comments on commit e379f11

Please sign in to comment.