Commit 05856903 by Ned Batchelder

A few improvements to extract.

Use the configuration more, and we don't need to delete files we're
about to create.
parent f76a5e17
......@@ -32,6 +32,15 @@ locales:
# The locale used for fake-accented English, for testing.
dummy-locale: eo
# Directories we don't search for strings.
ignore_dirs:
- docs
- src
- i18n
- test_root
- common/static/xmodule/modules
- common/static/xmodule/descriptors
# How should .po files be segmented? See i18n/segment.py for details. Strings
# that are only found in a particular segment are segregated into that .po file
# so that translators can focus on separate parts of the product.
......
......@@ -40,15 +40,13 @@ def main():
create_dir_if_necessary(LOCALE_DIR)
source_msgs_dir = CONFIGURATION.source_messages_dir
remove_file(source_msgs_dir.joinpath('django.po'))
generated_files = ('django-partial.po', 'djangojs.po', 'mako.po')
for filename in generated_files:
remove_file(source_msgs_dir.joinpath(filename))
generated_files = ['django-partial.po', 'djangojs.po', 'mako.po']
# Prepare makemessages command.
ignore_dirs = ["docs", "src", "i18n", "test_root"]
ignores = " ".join("--ignore={}/*".format(d) for d in ignore_dirs)
makemessages = 'django-admin.py makemessages -l en ' + ignores
makemessages = "django-admin.py makemessages -l en"
ignores = " ".join("--ignore={}/*".format(d) for d in CONFIGURATION.ignore_dirs)
if ignores:
makemessages += " " + ignores
# Extract strings from mako templates.
babel_mako_cmd = 'pybabel extract -F %s -c "Translators:" . -o %s' % (BABEL_CONFIG, BABEL_OUT)
......@@ -80,6 +78,7 @@ def main():
strip_key_strings(po)
po.save()
def fix_header(po):
"""
Replace default headers with edX headers
......
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