make l10n_check command only output l10n template if blocks exist

This commit is contained in:
James Long 2011-12-14 15:52:13 -05:00
Родитель ded297bc72
Коммит 8a137d7e97
1 изменённых файлов: 4 добавлений и 4 удалений

Просмотреть файл

@ -169,13 +169,13 @@ def copy_template(tmpl, lang):
"""Create a new l10n template by copying the l10n blocks"""
parser = L10nParser()
blocks = parser.parse_template(app_tmpl(tmpl), only_blocks=True)
blocks = list(parser.parse_template(app_tmpl(tmpl), only_blocks=True))
dest_file = l10n_tmpl(tmpl, lang)
# Make sure the templates directory for this locale and app exists
ensure_dir_exists(os.path.dirname(dest_file))
if blocks:
# Make sure the templates directory for this locale and app exists
ensure_dir_exists(os.path.dirname(dest_file))
with codecs.open(dest_file, 'w', 'utf-8') as dest:
dest.write('{# Version: %s #}\n\n' % get_todays_version())
dest.write('{%% extends "%s" %%}\n\n' % tmpl)