diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-02-23 00:34:13 +0200 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-02-23 00:34:13 +0200 |
commit | c8bf9d41547010195dcaea5d7a36ad8518a80090 (patch) | |
tree | b8e344cb108af38d23f781a8e1797133dbb49e25 /lang | |
parent | 75834b41474c9c89457e71f3d9c5fb38f6fb57c0 (diff) | |
download | evol-tools-c8bf9d41547010195dcaea5d7a36ad8518a80090.tar.gz evol-tools-c8bf9d41547010195dcaea5d7a36ad8518a80090.tar.bz2 evol-tools-c8bf9d41547010195dcaea5d7a36ad8518a80090.tar.xz evol-tools-c8bf9d41547010195dcaea5d7a36ad8518a80090.zip |
lang: fix some errors in lang tool and move root path to variable.
Diffstat (limited to 'lang')
-rwxr-xr-x | lang/updatelang.py | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/lang/updatelang.py b/lang/updatelang.py index 3f28085..41a96eb 100755 --- a/lang/updatelang.py +++ b/lang/updatelang.py @@ -90,8 +90,8 @@ def addMissingLines(): oldFile = oldLangFiles[trans][0] for str in newFile: if str not in allStrings: - if newFile[str] != "": - oldFile[str] = newFile[str] +# if newFile[str] != "": + oldFile[str] = newFile[str] for str in oldFile: if str in newFile: del newFile[str] @@ -128,16 +128,17 @@ def sortDict(adict): def saveFiles(dir): for trans in langFiles: - writeFile (dir + "/lang_" + trans + ".txt", langFiles[trans]) - writeFile (dir + "/lang_" + trans + ".old", oldLangFiles[trans]) + writeFile (dir + "/lang_" + trans + ".txt", langFiles[trans], False) + writeFile (dir + "/lang_" + trans + ".old", oldLangFiles[trans], True) -def writeFile(dir, texts): +def writeFile(dir, texts, isold): with open (dir, "w") as f: if texts[1] is not None: f.write(texts[1]) for line in texts[0]: - f.write (line[0] + "\n") - f.write (line[1] + "\n\n") + if not isold or (line[1] is not None and len(line[1]) > 0): + f.write (line[0] + "\n") + f.write (line[1] + "\n\n") def loadItemDb(dir): @@ -149,10 +150,11 @@ def loadItemDb(dir): continue itemNamesByName[rows[1].lower().strip()] = rows[2].strip() +rootPath = "../../gittorious/serverdata" -loadItemDb("../../privserverdata/db") -collectStrings("../../privserverdata/npc") -loadFiles("../../privserverdata/langs") +loadItemDb(rootPath + "/db") +collectStrings(rootPath + "/npc") +loadFiles(rootPath + "/langs") addMissingLines() sorting() -saveFiles("../../privserverdata/langs") +saveFiles(rootPath + "/langs") |