diff --git a/po/update_mo.py b/po/update_mo.py index fc70891de8f..33b7baaed69 100755 --- a/po/update_mo.py +++ b/po/update_mo.py @@ -27,7 +27,8 @@ import subprocess import os import sys -CURRENT_DIR = os.path.dirname(__file__) +GETTEXT_MSGFMT_EXECUTABLE = "msgfmt" +CURRENT_DIR = os.path.abspath(os.path.dirname(__file__)) SOURCE_DIR = os.path.normpath(os.path.abspath(os.path.join(CURRENT_DIR, ".."))) LOCALE_DIR = os.path.join(SOURCE_DIR, "release", "bin", ".blender", "locale") @@ -38,7 +39,7 @@ def process_po(po): lang = os.path.basename(po)[:-3] # show stats - cmd = ("msgfmt", + cmd = (GETTEXT_MSGFMT_EXECUTABLE, "--statistics", os.path.join(CURRENT_DIR, "%s.po" % lang), "-o", diff --git a/po/update_msg.py b/po/update_msg.py index a58fd4b7998..fc3e26b1980 100644 --- a/po/update_msg.py +++ b/po/update_msg.py @@ -26,7 +26,7 @@ import os -CURRENT_DIR = os.path.dirname(__file__) +CURRENT_DIR = os.path.abspath(os.path.dirname(__file__)) SOURCE_DIR = os.path.normpath(os.path.abspath(os.path.join(CURRENT_DIR, ".."))) FILE_NAME_MESSAGES = os.path.join(CURRENT_DIR, "messages.txt") diff --git a/po/update_po.py b/po/update_po.py index 45738363966..978de6ab1e5 100755 --- a/po/update_po.py +++ b/po/update_po.py @@ -27,7 +27,8 @@ import subprocess import os import sys -CURRENT_DIR = os.path.dirname(__file__) +GETTEXT_MSGMERGE_EXECUTABLE = "msgmerge" +CURRENT_DIR = os.path.abspath(os.path.dirname(__file__)) DOMAIN = "blender" @@ -35,7 +36,7 @@ def process_po(po): lang = os.path.basename(po)[:-3] # update po file - cmd = ("msgmerge", + cmd = (GETTEXT_MSGMERGE_EXECUTABLE, "--update", "--lang=%s" % lang, os.path.join(CURRENT_DIR, "%s.po" % lang), diff --git a/po/update_pot.py b/po/update_pot.py index 6c1d473b7f8..33f0b397462 100755 --- a/po/update_pot.py +++ b/po/update_pot.py @@ -25,9 +25,10 @@ import subprocess import os +from codecs import open GETTEXT_XGETTEXT_EXECUTABLE = "xgettext" -CURRENT_DIR = os.path.dirname(__file__) +CURRENT_DIR = os.path.abspath(os.path.dirname(__file__)) SOURCE_DIR = os.path.normpath(os.path.abspath(os.path.join(CURRENT_DIR, ".."))) DOMAIN = "blender" @@ -55,7 +56,7 @@ def main(): pot_messages = {} reading_message = False message = "" - with open(FILE_NAME_POT, 'r') as handle: + with open(FILE_NAME_POT, 'r', "utf-8") as handle: while True: line = handle.readline() @@ -73,8 +74,8 @@ def main(): message += line[1:-1] # add messages collected automatically from RNA - with open(FILE_NAME_POT, "a") as pot_handle: - with open(FILE_NAME_MESSAGES, 'r') as handle: + with open(FILE_NAME_POT, "a", "utf-8") as pot_handle: + with open(FILE_NAME_MESSAGES, 'r', "utf-8") as handle: while True: line = handle.readline()