Commit 644d4ac0 by louyihua

Extract i18n strings from *.underscore files using django-babel-underscore

Change strings from mako.po into underscore.po, which is finally merged into djangojs.po.
parent 563d71c1
......@@ -11,9 +11,3 @@ input_encoding = utf-8
input_encoding = utf-8
[mako: lms/templates/emails/**.txt]
input_encoding = utf-8
[underscore: **.underscore]
input_encoding = utf-8
[extractors]
underscore = django_babel_underscore:extract
......@@ -4,9 +4,3 @@ input_encoding = utf-8
[django: **/template/**.html]
input_encoding = utf-8
[underscore: **.underscore]
input_encoding = utf-8
[extractors]
underscore = django_babel_underscore:extract
# Use this configuration file for extracting strings from .underscore files.
[underscore: **.underscore]
input_encoding = utf-8
[extractors]
underscore = django_babel_underscore:extract
......@@ -121,3 +121,4 @@ generate_merge:
djangojs.po:
- djangojs-partial.po
- djangojs-studio.po
- underscore.po
......@@ -58,19 +58,27 @@ def main(verbosity=1):
}
babel_verbosity = verbosity_map.get(verbosity, "")
if verbosity:
stderr = None
else:
stderr = DEVNULL
babel_mako_cmd = 'pybabel {verbosity} extract -F {config} -c "Translators:" . -o {output}'
babel_mako_cmd = babel_mako_cmd.format(
verbosity=babel_verbosity,
config=base(LOCALE_DIR, 'babel_mako.cfg'),
output=base(CONFIGURATION.source_messages_dir, 'mako.po'),
)
if verbosity:
stderr = None
else:
stderr = DEVNULL
execute(babel_mako_cmd, working_directory=BASE_DIR, stderr=stderr)
babel_underscore_cmd = 'pybabel {verbosity} extract -F {config} -c "Translators:" . -o {output}'
babel_underscore_cmd = babel_underscore_cmd.format(
verbosity=babel_verbosity,
config=base(LOCALE_DIR, 'babel_underscore.cfg'),
output=base(CONFIGURATION.source_messages_dir, 'underscore.po'),
)
execute(babel_underscore_cmd, working_directory=BASE_DIR, stderr=stderr)
makemessages = "django-admin.py makemessages -l en -v{}".format(verbosity)
ignores = " ".join('--ignore="{}/*"'.format(d) for d in CONFIGURATION.ignore_dirs)
if ignores:
......@@ -100,6 +108,8 @@ def main(verbosity=1):
files_to_clean = set()
files_to_clean.add(source_msgs_dir / "underscore.po")
# Extract strings from third-party applications.
for app_name in CONFIGURATION.third_party:
# Import the app to find out where it is. Then use pybabel to extract
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment