diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2011-09-28 12:13:06 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2011-09-28 12:13:06 +0400 |
commit | c941403bc30528e4a90d180c7351c5bf1882fff6 (patch) | |
tree | a8a89f3ef341971b91875134682b43510c5dc683 /po/update_mo.py | |
parent | 4158cee688f4a63f8f3a4ff5e20fa3c6b3f95719 (diff) |
i18n: wrote small instruction for translators
- Added po/README.txt file with translation instructions
- If update_po and update_mo scripts now allows to provide list
of languages which should be handled only, i.e.
./update_mo.py ru
- Removed obsolete file from POTFILES.in
Diffstat (limited to 'po/update_mo.py')
-rwxr-xr-x | po/update_mo.py | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/po/update_mo.py b/po/update_mo.py index 51591af8a0e..fc70891de8f 100755 --- a/po/update_mo.py +++ b/po/update_mo.py @@ -25,6 +25,7 @@ import subprocess import os +import sys CURRENT_DIR = os.path.dirname(__file__) SOURCE_DIR = os.path.normpath(os.path.abspath(os.path.join(CURRENT_DIR, ".."))) @@ -33,21 +34,33 @@ LOCALE_DIR = os.path.join(SOURCE_DIR, "release", "bin", ".blender", "locale") DOMAIN = "blender" +def process_po(po): + lang = os.path.basename(po)[:-3] + + # show stats + cmd = ("msgfmt", + "--statistics", + os.path.join(CURRENT_DIR, "%s.po" % lang), + "-o", + os.path.join(LOCALE_DIR, lang, "LC_MESSAGES", "%s.mo" % DOMAIN), + ) + + print(" ".join(cmd)) + process = subprocess.Popen(cmd) + process.wait() + + def main(): - for po in os.listdir(CURRENT_DIR): - if po.endswith(".po"): - lang = po[:-3] - # show stats - cmd = ("msgfmt", - "--statistics", - os.path.join(CURRENT_DIR, "%s.po" % lang), - "-o", - os.path.join(LOCALE_DIR, lang, "LC_MESSAGES", "%s.mo" % DOMAIN), - ) - - print(" ".join(cmd)) - process = subprocess.Popen(cmd) - process.wait() + if len(sys.argv) > 1: + for lang in sys.argv[1:]: + po = os.path.join(CURRENT_DIR, lang + '.po') + + if os.path.exists(po): + process_po(po) + else: + for po in os.listdir(CURRENT_DIR): + if po.endswith(".po"): + process_po(po) if __name__ == "__main__": print("\n\n *** Running %r *** \n" % __file__) |