Clean translation diffs from OLDVALUE comments before merge, issue #116, patch provided by Łukasz K

This commit is contained in:
kaetemi 2014-02-12 16:35:07 +01:00
parent 46bf57aaf7
commit 0b3186ac6a
7 changed files with 232 additions and 3 deletions

View file

@ -0,0 +1,54 @@
#!/usr/bin/python
#
# \author Lukasz Kolasa (Maczuga)
#
# NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
# Copyright (C) 2014 by authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
import time, sys, os, shutil, subprocess, distutils.dir_util
sys.path.append("../configuration")
from scripts import *
from buildsite import *
from tools import *
os.chdir(TranslationDirectory)
if os.path.isfile("log.log"):
os.remove("log.log")
log = open("log.log", "w")
printLog(log, "")
printLog(log, "-------")
printLog(log, "--- Clean string diff")
printLog(log, "-------")
printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time())))
printLog(log, "")
TranslationTools = findTool(log, ToolDirectories, TranslationToolsTool, ToolSuffix)
try:
subprocess.call([ TranslationTools, "clean_string_diff" ])
except Exception, e:
printLog(log, "<" + processName + "> " + str(e))
printLog(log, "")
log.close()
if os.path.isfile("e1_clean_string_diff.log"):
os.remove("e1_clean_string_diff.log")
shutil.copy("log.log", "e1_clean_string_diff_" + time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + ".log")
shutil.move("log.log", "e1_clean_string_diff.log")
raw_input("PRESS ANY KEY TO EXIT")

View file

@ -0,0 +1,54 @@
#!/usr/bin/python
#
# \author Lukasz Kolasa (Maczuga)
#
# NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
# Copyright (C) 2014 by authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
import time, sys, os, shutil, subprocess, distutils.dir_util
sys.path.append("../configuration")
from scripts import *
from buildsite import *
from tools import *
os.chdir(TranslationDirectory)
if os.path.isfile("log.log"):
os.remove("log.log")
log = open("log.log", "w")
printLog(log, "")
printLog(log, "-------")
printLog(log, "--- Clean words diff")
printLog(log, "-------")
printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time())))
printLog(log, "")
TranslationTools = findTool(log, ToolDirectories, TranslationToolsTool, ToolSuffix)
try:
subprocess.call([ TranslationTools, "clean_words_diff" ])
except Exception, e:
printLog(log, "<" + processName + "> " + str(e))
printLog(log, "")
log.close()
if os.path.isfile("e2_clean_words_diff.log"):
os.remove("e2_clean_words_diff.log")
shutil.copy("log.log", "e2_clean_words_diff_" + time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + ".log")
shutil.move("log.log", "e2_clean_words_diff.log")
raw_input("PRESS ANY KEY TO EXIT")

View file

@ -0,0 +1,54 @@
#!/usr/bin/python
#
# \author Lukasz Kolasa (Maczuga)
#
# NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
# Copyright (C) 2014 by authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
import time, sys, os, shutil, subprocess, distutils.dir_util
sys.path.append("../configuration")
from scripts import *
from buildsite import *
from tools import *
os.chdir(TranslationDirectory)
if os.path.isfile("log.log"):
os.remove("log.log")
log = open("log.log", "w")
printLog(log, "")
printLog(log, "-------")
printLog(log, "--- Clean clause diff")
printLog(log, "-------")
printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time())))
printLog(log, "")
TranslationTools = findTool(log, ToolDirectories, TranslationToolsTool, ToolSuffix)
try:
subprocess.call([ TranslationTools, "clean_clause_diff" ])
except Exception, e:
printLog(log, "<" + processName + "> " + str(e))
printLog(log, "")
log.close()
if os.path.isfile("e3_clean_clause_diff.log"):
os.remove("e3_clean_clause_diff.log")
shutil.copy("log.log", "e3_clean_clause_diff_" + time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + ".log")
shutil.move("log.log", "e3_clean_clause_diff.log")
raw_input("PRESS ANY KEY TO EXIT")

View file

@ -0,0 +1,54 @@
#!/usr/bin/python
#
# \author Lukasz Kolasa (Maczuga)
#
# NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
# Copyright (C) 2014 by authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
import time, sys, os, shutil, subprocess, distutils.dir_util
sys.path.append("../configuration")
from scripts import *
from buildsite import *
from tools import *
os.chdir(TranslationDirectory)
if os.path.isfile("log.log"):
os.remove("log.log")
log = open("log.log", "w")
printLog(log, "")
printLog(log, "-------")
printLog(log, "--- Clean phrase diff")
printLog(log, "-------")
printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time())))
printLog(log, "")
TranslationTools = findTool(log, ToolDirectories, TranslationToolsTool, ToolSuffix)
try:
subprocess.call([ TranslationTools, "clean_phrase_diff" ])
except Exception, e:
printLog(log, "<" + processName + "> " + str(e))
printLog(log, "")
log.close()
if os.path.isfile("e4_clean_phrase_diff.log"):
os.remove("e4_clean_phrase_diff.log")
shutil.copy("log.log", "e4_clean_phrase_diff_" + time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + ".log")
shutil.move("log.log", "e4_clean_phrase_diff.log")
raw_input("PRESS ANY KEY TO EXIT")

View file

@ -47,6 +47,10 @@ try:
subprocess.call([ TranslationTools, "merge_words_diff" ])
subprocess.call([ TranslationTools, "make_string_diff" ])
subprocess.call([ TranslationTools, "merge_string_diff" ])
subprocess.call([ TranslationTools, "clean_string_diff" ])
subprocess.call([ TranslationTools, "clean_words_diff" ])
subprocess.call([ TranslationTools, "clean_clause_diff" ])
subprocess.call([ TranslationTools, "clean_phrase_diff" ])
subprocess.call([ TranslationTools, "make_worksheet_diff", "bot_names.txt" ])
subprocess.call([ TranslationTools, "merge_worksheet_diff", "bot_names.txt" ])
except Exception, e:

View file

@ -31,7 +31,7 @@ log = open("log.log", "w")
printLog(log, "")
printLog(log, "-------")
printLog(log, "--- Make and merge work")
printLog(log, "--- Make, merge and clean work")
printLog(log, "-------")
printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time())))
printLog(log, "")
@ -76,6 +76,15 @@ for diffFile in diffFiles:
printLog(log, "DIFF " + "diff/" + diffFile)
subprocess.call([ TranslationTools, "crop_lines", "diff/" + diffFile, "3" ])
#printLog(log, ">>> Clean diff <<<")
#try:
# subprocess.call([ TranslationTools, "clean_string_diff" ])
# subprocess.call([ TranslationTools, "clean_phrase_diff" ])
# subprocess.call([ TranslationTools, "clean_clause_diff" ])
# subprocess.call([ TranslationTools, "clean_words_diff" ])
#except Exception, e:
# printLog(log, "<" + processName + "> " + str(e))
#printLog(log, "")
printLog(log, ">>> Merge diff <<<")
try:

View file

@ -1574,7 +1574,7 @@ int cleanWordsDiff(int argc, char *argv[])
{
LOG("Cleaning words diffs\n");
/*
uint i,l;
for (l=0; l<Languages.size(); ++l)
@ -1588,7 +1588,7 @@ int cleanWordsDiff(int argc, char *argv[])
cleanComment(diffs[i]);
}
}
*/
return 0;
}