Commit c712668b by Calen Pennington

Merge pull request #2292 from edx/sarina/make-dummy-executable

Convert i18n/make_dummy.py to a standalone script
parents 7162aa66 c0470008
...@@ -12,15 +12,13 @@ ...@@ -12,15 +12,13 @@
# #
# po files can be generated with this: # po files can be generated with this:
# django-admin.py makemessages --all --extension html -l en # django-admin.py makemessages --all --extension html -l en
# Usage:
# #
# $ ./make_dummy.py <sourcefile> # Usage:
# #
# $ ./make_dummy.py ../conf/locale/en/LC_MESSAGES/django.po # $ ./make_dummy.py
# #
# generates output to # generates output conf/locale/$DUMMY_LOCALE/LC_MESSAGES,
# edx-platform/conf/locale/eo/LC_MESSAGES/django.po # where $DUMMY_LOCALE is the dummy_locale value set in the i18n config
import os, sys import os, sys
import polib import polib
...@@ -59,12 +57,10 @@ def new_filename(original_filename, new_locale): ...@@ -59,12 +57,10 @@ def new_filename(original_filename, new_locale):
return os.path.abspath(os.path.join(orig_dir, '../..', new_locale, msgs_dir, orig_file)) return os.path.abspath(os.path.join(orig_dir, '../..', new_locale, msgs_dir, orig_file))
if __name__ == '__main__': if __name__ == '__main__':
# required arg: file LOCALE = CONFIGURATION.dummy_locale
if len(sys.argv) < 2: SOURCE_MSGS_DIR = CONFIGURATION.source_messages_dir
raise Exception("missing file argument") print "Processing source language files into dummy strings:"
# optional arg: locale for source_file in CONFIGURATION.source_messages_dir.walkfiles('*.po'):
if len(sys.argv) < 3: print ' ', source_file.relpath()
locale = CONFIGURATION.get_dummy_locale() main(SOURCE_MSGS_DIR.joinpath(source_file), LOCALE)
else: print
locale = sys.argv[2]
main(sys.argv[1], locale)
...@@ -14,12 +14,7 @@ namespace :i18n do ...@@ -14,12 +14,7 @@ namespace :i18n do
desc "Simulate international translation by generating dummy strings corresponding to source strings." desc "Simulate international translation by generating dummy strings corresponding to source strings."
task :dummy do task :dummy do
source_files = Dir["#{REPO_ROOT}/conf/locale/en/LC_MESSAGES/*.po"] sh(File.join(REPO_ROOT, "i18n", "make_dummy.py"))
dummy_locale = 'eo'
cmd = File.join(REPO_ROOT, "i18n", "make_dummy.py")
for file in source_files do
sh("#{cmd} #{file} #{dummy_locale}")
end
end end
namespace :validate do namespace :validate do
......
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