Linux multi-monitor fullscreen support
[ryzomcore.git] / nel / tools / build_gamedata / translation / make_merge_wk.py
blob45f7d6ecf783d1afd5fae3456151629ece50433b
1 #!/usr/bin/python
2 #
3 # \author Jan Boon (Kaetemi)
4 #
5 # NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
6 # Copyright (C) 2014 by authors
8 # This program is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU Affero General Public License as
10 # published by the Free Software Foundation, either version 3 of the
11 # License, or (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU Affero General Public License for more details.
18 # You should have received a copy of the GNU Affero General Public License
19 # along with this program. If not, see <http://www.gnu.org/licenses/>.
22 import time, sys, os, shutil, subprocess, distutils.dir_util
23 sys.path.append("../configuration")
24 from scripts import *
25 from buildsite import *
26 from tools import *
27 os.chdir(TranslationDirectory)
28 if os.path.isfile("log.log"):
29 os.remove("log.log")
30 log = open("log.log", "w")
32 printLog(log, "")
33 printLog(log, "-------")
34 printLog(log, "--- Make, merge and clean work")
35 printLog(log, "-------")
36 printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time())))
37 printLog(log, "")
40 TranslationTools = findTool(log, ToolDirectories, TranslationToolsTool, ToolSuffix)
41 printLog(log, ">>> Override languages.txt <<<")
42 if not os.path.isfile("make_merge_wk_languages.txt"):
43 shutil.move("languages.txt", "make_merge_wk_languages.txt")
44 languagesTxt = open("languages.txt", "w")
45 languagesTxt.write("wk\n")
46 languagesTxt.close()
49 printLog(log, ">>> Merge diff <<<") # This is necessary, because when we crop lines, we should only do this from untranslated files
50 try:
51 subprocess.call([ TranslationTools, "merge_phrase_diff" ])
52 subprocess.call([ TranslationTools, "merge_clause_diff" ])
53 subprocess.call([ TranslationTools, "merge_words_diff" ])
54 subprocess.call([ TranslationTools, "merge_string_diff" ])
55 subprocess.call([ TranslationTools, "merge_r2_string_diff" ])
56 subprocess.call([ TranslationTools, "merge_worksheet_diff", "bot_names.txt" ])
57 except Exception, e:
58 printLog(log, "<" + processName + "> " + str(e))
59 printLog(log, "")
62 printLog(log, ">>> Make diff <<<")
63 try:
64 subprocess.call([ TranslationTools, "make_phrase_diff" ])
65 subprocess.call([ TranslationTools, "make_clause_diff" ])
66 subprocess.call([ TranslationTools, "make_words_diff" ])
67 subprocess.call([ TranslationTools, "make_string_diff" ])
68 subprocess.call([ TranslationTools, "make_r2_string_diff" ])
69 subprocess.call([ TranslationTools, "make_worksheet_diff", "bot_names.txt" ])
70 except Exception, e:
71 printLog(log, "<" + processName + "> " + str(e))
74 printLog(log, ">>> Mark diffs as translated <<<")
75 diffFiles = os.listdir("diff")
76 for diffFile in diffFiles:
77 if "wk_diff_" in diffFile:
78 printLog(log, "DIFF " + "diff/" + diffFile)
79 subprocess.call([ TranslationTools, "crop_lines", "diff/" + diffFile, "3" ])
81 #printLog(log, ">>> Clean diff <<<")
82 #try:
83 # subprocess.call([ TranslationTools, "clean_string_diff" ])
84 # subprocess.call([ TranslationTools, "clean_phrase_diff" ])
85 # subprocess.call([ TranslationTools, "clean_clause_diff" ])
86 # subprocess.call([ TranslationTools, "clean_words_diff" ])
87 #except Exception, e:
88 # printLog(log, "<" + processName + "> " + str(e))
89 #printLog(log, "")
91 printLog(log, ">>> Merge diff <<<")
92 try:
93 subprocess.call([ TranslationTools, "merge_phrase_diff" ])
94 subprocess.call([ TranslationTools, "merge_clause_diff" ])
95 subprocess.call([ TranslationTools, "merge_words_diff" ])
96 subprocess.call([ TranslationTools, "merge_string_diff" ])
97 subprocess.call([ TranslationTools, "merge_r2_string_diff" ])
98 subprocess.call([ TranslationTools, "merge_worksheet_diff", "bot_names.txt" ])
99 except Exception, e:
100 printLog(log, "<" + processName + "> " + str(e))
101 printLog(log, "")
104 printLog(log, ">>> Restore languages.txt <<<")
105 os.remove("languages.txt")
106 shutil.move("make_merge_wk_languages.txt", "languages.txt")
109 log.close()
110 if os.path.isfile("make_merge_wk.log"):
111 os.remove("make_merge_wk.log")
112 shutil.copy("log.log", "make_merge_wk_" + time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + ".log")
113 shutil.move("log.log", "make_merge_wk.log")
115 raw_input("PRESS ANY KEY TO EXIT")