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_po.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_po.py')
-rwxr-xr-x | po/update_po.py | 42 |
1 files changed, 27 insertions, 15 deletions
diff --git a/po/update_po.py b/po/update_po.py index bbdf7224908..45738363966 100755 --- a/po/update_po.py +++ b/po/update_po.py @@ -25,27 +25,39 @@ import subprocess import os +import sys CURRENT_DIR = os.path.dirname(__file__) DOMAIN = "blender" +def process_po(po): + lang = os.path.basename(po)[:-3] + + # update po file + cmd = ("msgmerge", + "--update", + "--lang=%s" % lang, + os.path.join(CURRENT_DIR, "%s.po" % lang), + os.path.join(CURRENT_DIR, "%s.pot" % 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] - - # update po file - cmd = ("msgmerge", - "--update", - "--lang=%s" % lang, - os.path.join(CURRENT_DIR, "%s.po" % lang), - os.path.join(CURRENT_DIR, "%s.pot" % 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__": |