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: ...@@ -32,6 +32,15 @@ locales:
# The locale used for fake-accented English, for testing. # The locale used for fake-accented English, for testing.
dummy-locale: eo 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 # 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 # 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. # so that translators can focus on separate parts of the product.
......
...@@ -40,15 +40,13 @@ def main(): ...@@ -40,15 +40,13 @@ def main():
create_dir_if_necessary(LOCALE_DIR) create_dir_if_necessary(LOCALE_DIR)
source_msgs_dir = CONFIGURATION.source_messages_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']
generated_files = ('django-partial.po', 'djangojs.po', 'mako.po')
for filename in generated_files:
remove_file(source_msgs_dir.joinpath(filename))
# Prepare makemessages command. # Prepare makemessages command.
ignore_dirs = ["docs", "src", "i18n", "test_root"] makemessages = "django-admin.py makemessages -l en"
ignores = " ".join("--ignore={}/*".format(d) for d in ignore_dirs) ignores = " ".join("--ignore={}/*".format(d) for d in CONFIGURATION.ignore_dirs)
makemessages = 'django-admin.py makemessages -l en ' + ignores if ignores:
makemessages += " " + ignores
# Extract strings from mako templates. # Extract strings from mako templates.
babel_mako_cmd = 'pybabel extract -F %s -c "Translators:" . -o %s' % (BABEL_CONFIG, BABEL_OUT) babel_mako_cmd = 'pybabel extract -F %s -c "Translators:" . -o %s' % (BABEL_CONFIG, BABEL_OUT)
...@@ -80,6 +78,7 @@ def main(): ...@@ -80,6 +78,7 @@ def main():
strip_key_strings(po) strip_key_strings(po)
po.save() po.save()
def fix_header(po): def fix_header(po):
""" """
Replace default headers with edX headers 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