Commit 788ed13b by Calen Pennington

Rename djangojs.po to djangojs-partial.po in transifex, to prevent header creep

parent 4e879a4c
...@@ -13,9 +13,9 @@ source_file = conf/locale/en/LC_MESSAGES/django-studio.po ...@@ -13,9 +13,9 @@ source_file = conf/locale/en/LC_MESSAGES/django-studio.po
source_lang = en source_lang = en
type = PO type = PO
[edx-platform.djangojs] [edx-platform.djangojs-partial]
file_filter = conf/locale/<lang>/LC_MESSAGES/djangojs.po file_filter = conf/locale/<lang>/LC_MESSAGES/djangojs-partial.po
source_file = conf/locale/en/LC_MESSAGES/djangojs.po source_file = conf/locale/en/LC_MESSAGES/djangojs-partial.po
source_lang = en source_lang = en
type = PO type = PO
......
...@@ -53,7 +53,7 @@ segment: ...@@ -53,7 +53,7 @@ segment:
django-studio.po: # produces this .po file.. django-studio.po: # produces this .po file..
- cms/* # by segregating strings from these files. - cms/* # by segregating strings from these files.
# Anything that doesn't match a pattern stays in the original file. # Anything that doesn't match a pattern stays in the original file.
djangojs.po: djangojs-partial.po:
djangojs-studio.po: djangojs-studio.po:
- cms/* - cms/*
mako.po: mako.po:
...@@ -69,5 +69,5 @@ generate_merge: ...@@ -69,5 +69,5 @@ generate_merge:
- mako-studio.po - mako-studio.po
- messages.po - messages.po
djangojs.po: djangojs.po:
- djangojs.po - djangojs-partial.po
- djangojs-studio.po - djangojs-studio.po
...@@ -6,7 +6,7 @@ See https://edx-wiki.atlassian.net/wiki/display/ENG/PO+File+workflow ...@@ -6,7 +6,7 @@ See https://edx-wiki.atlassian.net/wiki/display/ENG/PO+File+workflow
This task extracts all English strings from all source code This task extracts all English strings from all source code
and produces three human-readable files: and produces three human-readable files:
conf/locale/en/LC_MESSAGES/django-partial.po conf/locale/en/LC_MESSAGES/django-partial.po
conf/locale/en/LC_MESSAGES/djangojs.po conf/locale/en/LC_MESSAGES/djangojs-partial.po
conf/locale/en/LC_MESSAGES/mako.po conf/locale/en/LC_MESSAGES/mako.po
This task will clobber any existing django.po file. This task will clobber any existing django.po file.
...@@ -42,15 +42,15 @@ def main(): ...@@ -42,15 +42,15 @@ def main():
source_msgs_dir = CONFIGURATION.source_messages_dir source_msgs_dir = CONFIGURATION.source_messages_dir
remove_file(source_msgs_dir.joinpath('django.po')) remove_file(source_msgs_dir.joinpath('django.po'))
# Extract strings from mako templates.
babel_mako_cmd = 'pybabel extract -F %s -c "Translators:" . -o %s' % (BABEL_CONFIG, BABEL_OUT)
execute(babel_mako_cmd, working_directory=BASE_DIR)
makemessages = "django-admin.py makemessages -l en" makemessages = "django-admin.py makemessages -l en"
ignores = " ".join('--ignore="{}/*"'.format(d) for d in CONFIGURATION.ignore_dirs) ignores = " ".join('--ignore="{}/*"'.format(d) for d in CONFIGURATION.ignore_dirs)
if ignores: if ignores:
makemessages += " " + ignores makemessages += " " + ignores
# Extract strings from mako templates.
babel_mako_cmd = 'pybabel extract -F %s -c "Translators:" . -o %s' % (BABEL_CONFIG, BABEL_OUT)
execute(babel_mako_cmd, working_directory=BASE_DIR)
# Extract strings from django source files, including .py files. # Extract strings from django source files, including .py files.
make_django_cmd = makemessages + ' --extension html' make_django_cmd = makemessages + ' --extension html'
execute(make_django_cmd, working_directory=BASE_DIR) execute(make_django_cmd, working_directory=BASE_DIR)
...@@ -66,6 +66,13 @@ def main(): ...@@ -66,6 +66,13 @@ def main():
source_msgs_dir.joinpath('django-partial.po') source_msgs_dir.joinpath('django-partial.po')
) )
# makemessages creates 'djangojs.po'. This filename is hardcoded.
# Rename it to djangojs-partial.po to enable merging into djangojs.po later.
os.rename(
source_msgs_dir.joinpath('djangojs.po'),
source_msgs_dir.joinpath('djangojs-partial.po')
)
# Segment the generated files. # Segment the generated files.
segmented_files = segment_pofiles("en") segmented_files = segment_pofiles("en")
......
...@@ -17,7 +17,7 @@ class TestExtract(TestCase): ...@@ -17,7 +17,7 @@ class TestExtract(TestCase):
""" """
Tests functionality of i18n/extract.py Tests functionality of i18n/extract.py
""" """
generated_files = ('django-partial.po', 'djangojs.po', 'mako.po') generated_files = ('django-partial.po', 'djangojs-partial.po', 'mako.po')
def setUp(self): def setUp(self):
# Skip this test because it takes too long (>1 minute) # Skip this test because it takes too long (>1 minute)
......
...@@ -16,7 +16,7 @@ class TestGenerate(TestCase): ...@@ -16,7 +16,7 @@ class TestGenerate(TestCase):
""" """
Tests functionality of i18n/generate.py Tests functionality of i18n/generate.py
""" """
generated_files = ('django-partial.po', 'djangojs.po', 'mako.po') generated_files = ('django-partial.po', 'djangojs-partial.po', 'mako.po')
def setUp(self): def setUp(self):
# Subtract 1 second to help comparisons with file-modify time succeed, # Subtract 1 second to help comparisons with file-modify time succeed,
......
...@@ -37,7 +37,7 @@ def clean_locale(locale): ...@@ -37,7 +37,7 @@ def clean_locale(locale):
Iterates over machine-generated files. Iterates over machine-generated files.
""" """
dirname = CONFIGURATION.get_messages_dir(locale) dirname = CONFIGURATION.get_messages_dir(locale)
for filename in ('django-partial.po', 'djangojs.po', 'mako.po'): for filename in ('django-partial.po', 'djangojs-partial.po', 'mako.po'):
clean_file(dirname.joinpath(filename)) clean_file(dirname.joinpath(filename))
def clean_file(file): def clean_file(file):
......
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