From 12d8df970b76b4ee4117de9267fa5df90f71e2d5 Mon Sep 17 00:00:00 2001 From: louyihua Date: Thu, 5 Jun 2014 15:22:40 +0800 Subject: [PATCH] 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 --- conf/locale/config.yaml | 4 ++++ i18n/extract.py | 10 ++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/conf/locale/config.yaml b/conf/locale/config.yaml index 17c07cc705..d7614f440a 100644 --- a/conf/locale/config.yaml +++ b/conf/locale/config.yaml @@ -108,6 +108,9 @@ segment: mako.po: mako-studio.po: - cms/* + underscore.po: + underscore-studio.po: + - cms/* # How should the generate step merge files? generate_merge: @@ -122,3 +125,4 @@ generate_merge: - djangojs-partial.po - djangojs-studio.po - underscore.po + - underscore-studio.po diff --git a/i18n/extract.py b/i18n/extract.py index 502a33ca55..0aeeaadff3 100755 --- a/i18n/extract.py +++ b/i18n/extract.py @@ -63,16 +63,16 @@ def main(verbosity=1): else: stderr = DEVNULL - babel_mako_cmd = 'pybabel {verbosity} extract -F {config} -c "Translators:" . -o {output}' - babel_mako_cmd = babel_mako_cmd.format( + babel_cmd_template = 'pybabel {verbosity} extract -F {config} -c "Translators:" . -o {output}' + + babel_mako_cmd = babel_cmd_template.format( verbosity=babel_verbosity, config=base(LOCALE_DIR, 'babel_mako.cfg'), output=base(CONFIGURATION.source_messages_dir, 'mako.po'), ) 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( + babel_underscore_cmd = babel_cmd_template.format( verbosity=babel_verbosity, config=base(LOCALE_DIR, 'babel_underscore.cfg'), output=base(CONFIGURATION.source_messages_dir, 'underscore.po'), @@ -108,8 +108,6 @@ 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