Commit 12d8df97 by louyihua

Babel underscore extraction update according to @nedbat

1. Add underscore.po into the merge section in config.yaml
2. Using one babel command template to construct two babel commands
parent fa0dee17
...@@ -108,6 +108,9 @@ segment: ...@@ -108,6 +108,9 @@ segment:
mako.po: mako.po:
mako-studio.po: mako-studio.po:
- cms/* - cms/*
underscore.po:
underscore-studio.po:
- cms/*
# How should the generate step merge files? # How should the generate step merge files?
generate_merge: generate_merge:
...@@ -122,3 +125,4 @@ generate_merge: ...@@ -122,3 +125,4 @@ generate_merge:
- djangojs-partial.po - djangojs-partial.po
- djangojs-studio.po - djangojs-studio.po
- underscore.po - underscore.po
- underscore-studio.po
...@@ -63,16 +63,16 @@ def main(verbosity=1): ...@@ -63,16 +63,16 @@ def main(verbosity=1):
else: else:
stderr = DEVNULL stderr = DEVNULL
babel_mako_cmd = 'pybabel {verbosity} extract -F {config} -c "Translators:" . -o {output}' babel_cmd_template = 'pybabel {verbosity} extract -F {config} -c "Translators:" . -o {output}'
babel_mako_cmd = babel_mako_cmd.format(
babel_mako_cmd = babel_cmd_template.format(
verbosity=babel_verbosity, verbosity=babel_verbosity,
config=base(LOCALE_DIR, 'babel_mako.cfg'), config=base(LOCALE_DIR, 'babel_mako.cfg'),
output=base(CONFIGURATION.source_messages_dir, 'mako.po'), output=base(CONFIGURATION.source_messages_dir, 'mako.po'),
) )
execute(babel_mako_cmd, working_directory=BASE_DIR, stderr=stderr) 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_cmd_template.format(
babel_underscore_cmd = babel_underscore_cmd.format(
verbosity=babel_verbosity, verbosity=babel_verbosity,
config=base(LOCALE_DIR, 'babel_underscore.cfg'), config=base(LOCALE_DIR, 'babel_underscore.cfg'),
output=base(CONFIGURATION.source_messages_dir, 'underscore.po'), output=base(CONFIGURATION.source_messages_dir, 'underscore.po'),
...@@ -108,8 +108,6 @@ def main(verbosity=1): ...@@ -108,8 +108,6 @@ def main(verbosity=1):
files_to_clean = set() files_to_clean = set()
files_to_clean.add(source_msgs_dir / "underscore.po")
# Extract strings from third-party applications. # Extract strings from third-party applications.
for app_name in CONFIGURATION.third_party: for app_name in CONFIGURATION.third_party:
# Import the app to find out where it is. Then use pybabel to extract # 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