3
# ***** BEGIN GPL LICENSE BLOCK *****
5
# This program is free software; you can redistribute it and/or
6
# modify it under the terms of the GNU General Public License
7
# as published by the Free Software Foundation; either version 2
8
# of the License, or (at your option) any later version.
10
# This program is distributed in the hope that it will be useful,
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
15
# You should have received a copy of the GNU General Public License
16
# along with this program; if not, write to the Free Software Foundation,
17
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
# ***** END GPL LICENSE BLOCK *****
23
# Update all branches:
24
# * Generate a temp messages.txt file.
25
# * Use it to generate a temp .pot file.
26
# * Use it to update all .po’s in /branches.
36
from . import settings
39
PY3 = settings.PYTHON3_EXEC
41
FILE_NAME_POT = settings.FILE_NAME_POT
46
parser = argparse.ArgumentParser(description="Update all branches:\n"
47
"* Generate a temp messages.txt file.\n"
48
"* Use it to generate a blender.pot file.\n"
49
"* Use it to update all .po’s in /branches.")
50
#parser.add_argument('--pproc-contexts', action="store_true",
51
#help="Pre-process po’s to avoid having plenty of fuzzy msgids just because a context was "
53
parser.add_argument('-c', '--no_checks', default=True, action="store_false", help="No checks over UI messages.")
54
parser.add_argument('-a', '--add', action="store_true",
55
help="Add missing po’s (useful only when one or more languages are given!).")
56
parser.add_argument('langs', metavar='ISO_code', nargs='*', help="Restrict processed languages to those.")
57
args = parser.parse_args()
61
# Generate a temp messages file.
62
dummy, msgfile = tempfile.mkstemp(suffix=".txt", prefix="blender_messages_")
64
cmd = (PY3, "./update_msg.py", "-o", msgfile)
65
t = subprocess.call(cmd)
69
# Generate blender.pot file in trunk/po. It's quite useful for translators that want to start
70
# a new translation and not not want to bother generating their own po from scratch!
71
potfile = FILE_NAME_POT
72
cmd = [PY3, "./update_pot.py", "-i", msgfile, "-o", potfile]
73
if not args.no_checks:
75
t = subprocess.call(cmd)
79
# Update branches’ po files.
80
cmd = [PY3, "./update_po.py", "-i", potfile]
85
#if args.pproc_contexts:
86
#cmd.append("--pproc-contexts")
87
t = subprocess.call(cmd)
94
if __name__ == "__main__":
95
print("\n\n *** Running {} *** \n".format(__file__))