From 0b3186ac6ad76fca16b0518a864847b80fd99e92 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Wed, 12 Feb 2014 16:35:07 +0100 Subject: [PATCH] =?UTF-8?q?Clean=20translation=20diffs=20from=20OLDVALUE?= =?UTF-8?q?=20comments=20before=20merge,=20issue=20#116,=20patch=20provide?= =?UTF-8?q?d=20by=20=C5=81ukasz=20K?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../translation/e1_clean_string_diff.py | 54 +++++++++++++++++++ .../translation/e2_clean_words_diff.py | 54 +++++++++++++++++++ .../translation/e3_clean_clause_diff.py | 54 +++++++++++++++++++ .../translation/e4_clean_phrase_diff.py | 54 +++++++++++++++++++ .../translation/make_merge_all.py | 4 ++ .../translation/make_merge_wk.py | 11 +++- code/ryzom/tools/translation_tools/main.cpp | 4 +- 7 files changed, 232 insertions(+), 3 deletions(-) create mode 100644 code/nel/tools/build_gamedata/translation/e1_clean_string_diff.py create mode 100644 code/nel/tools/build_gamedata/translation/e2_clean_words_diff.py create mode 100644 code/nel/tools/build_gamedata/translation/e3_clean_clause_diff.py create mode 100644 code/nel/tools/build_gamedata/translation/e4_clean_phrase_diff.py diff --git a/code/nel/tools/build_gamedata/translation/e1_clean_string_diff.py b/code/nel/tools/build_gamedata/translation/e1_clean_string_diff.py new file mode 100644 index 000000000..9eafba1a6 --- /dev/null +++ b/code/nel/tools/build_gamedata/translation/e1_clean_string_diff.py @@ -0,0 +1,54 @@ +#!/usr/bin/python +# +# \author Lukasz Kolasa (Maczuga) +# +# NeL - MMORPG Framework +# 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 . +# + +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") diff --git a/code/nel/tools/build_gamedata/translation/e2_clean_words_diff.py b/code/nel/tools/build_gamedata/translation/e2_clean_words_diff.py new file mode 100644 index 000000000..a98c7b27c --- /dev/null +++ b/code/nel/tools/build_gamedata/translation/e2_clean_words_diff.py @@ -0,0 +1,54 @@ +#!/usr/bin/python +# +# \author Lukasz Kolasa (Maczuga) +# +# NeL - MMORPG Framework +# 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 . +# + +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") diff --git a/code/nel/tools/build_gamedata/translation/e3_clean_clause_diff.py b/code/nel/tools/build_gamedata/translation/e3_clean_clause_diff.py new file mode 100644 index 000000000..337ac6e99 --- /dev/null +++ b/code/nel/tools/build_gamedata/translation/e3_clean_clause_diff.py @@ -0,0 +1,54 @@ +#!/usr/bin/python +# +# \author Lukasz Kolasa (Maczuga) +# +# NeL - MMORPG Framework +# 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 . +# + +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") diff --git a/code/nel/tools/build_gamedata/translation/e4_clean_phrase_diff.py b/code/nel/tools/build_gamedata/translation/e4_clean_phrase_diff.py new file mode 100644 index 000000000..8f08d73ea --- /dev/null +++ b/code/nel/tools/build_gamedata/translation/e4_clean_phrase_diff.py @@ -0,0 +1,54 @@ +#!/usr/bin/python +# +# \author Lukasz Kolasa (Maczuga) +# +# NeL - MMORPG Framework +# 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 . +# + +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") diff --git a/code/nel/tools/build_gamedata/translation/make_merge_all.py b/code/nel/tools/build_gamedata/translation/make_merge_all.py index f6ea582a3..f4dbd95fb 100644 --- a/code/nel/tools/build_gamedata/translation/make_merge_all.py +++ b/code/nel/tools/build_gamedata/translation/make_merge_all.py @@ -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: diff --git a/code/nel/tools/build_gamedata/translation/make_merge_wk.py b/code/nel/tools/build_gamedata/translation/make_merge_wk.py index dee324f07..4442232ab 100644 --- a/code/nel/tools/build_gamedata/translation/make_merge_wk.py +++ b/code/nel/tools/build_gamedata/translation/make_merge_wk.py @@ -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: diff --git a/code/ryzom/tools/translation_tools/main.cpp b/code/ryzom/tools/translation_tools/main.cpp index 253eee75d..9eba8c8da 100644 --- a/code/ryzom/tools/translation_tools/main.cpp +++ b/code/ryzom/tools/translation_tools/main.cpp @@ -1574,7 +1574,7 @@ int cleanWordsDiff(int argc, char *argv[]) { LOG("Cleaning words diffs\n"); -/* + uint i,l; for (l=0; l