summaryrefslogtreecommitdiff
path: root/lang/updatelang.py
diff options
context:
space:
mode:
Diffstat (limited to 'lang/updatelang.py')
-rwxr-xr-xlang/updatelang.py37
1 files changed, 18 insertions, 19 deletions
diff --git a/lang/updatelang.py b/lang/updatelang.py
index aa36823..44ecb5c 100755
--- a/lang/updatelang.py
+++ b/lang/updatelang.py
@@ -1,4 +1,4 @@
-#! /usr/bin/env python2.7
+#!/usr/bin/env python3
# -*- coding: utf8 -*-
#
# Copyright (C) 2010-2015 Evol Online
@@ -27,7 +27,7 @@ langs = set()
itemNamesByName = dict()
def addStr(text, comment, fileName, lineNum, addNoC):
- text = text.replace("\a", "\"");
+ text = text.replace("\a", "\"")
allStrings.add(text)
if comment[-1:] == "\n":
comment = comment[:-1]
@@ -45,7 +45,7 @@ def collectScriptFileStrings(codeFile, file2):
cnt = -1
for line in f:
cnt = cnt + 1
- line = line.replace("\\\"", "\a");
+ line = line.replace("\\\"", "\a")
m = strre1.findall(line)
if len(m) > 0:
for str in m:
@@ -123,8 +123,7 @@ def parseFile(name, readFirstLine):
firstLine = None
if os.path.exists(name):
with open(name, "r") as f:
- line1 = "";
- line2 = "";
+ line1 = line2 = ""
for line in f:
if readFirstLine is True and firstLine is None:
firstLine = line
@@ -178,7 +177,7 @@ def parsePoFile(name, path):
if flag == 2:
if line1 != "":
if line1 in langFile and line2 != "":
- langFile[line1] = line2.replace("\\\"", "\"");
+ langFile[line1] = line2.replace("\\\"", "\"")
flag = 0
idx = line.find ("\"")
@@ -285,7 +284,7 @@ def writePoFile(poDir, texts, trans):
else:
langDir = poDir + "/" + trans + ".po"
- print langDir
+ print(langDir)
with open (langDir, "w") as w:
w.write ("# " + texts[1] + "")
w.write ("#\n\n")
@@ -301,13 +300,13 @@ def writePoFile(poDir, texts, trans):
writePoComments(w, strComments[line[0]])
srcLine = line[0]
- srcLine = srcLine.replace("\\", "\\\\");
+ srcLine = srcLine.replace("\\", "\\\\")
srcLine = srcLine.replace("\"", "\\\"")
w.write ("msgid \"" + srcLine + "\"\n")
trLine = line[1]
if trans == "en":
trLine = ""
- trLine = trLine.replace("\\", "\\\\");
+ trLine = trLine.replace("\\", "\\\\")
trLine = trLine.replace("\"", "\\\"")
w.write ("msgstr \"" + trLine + "\"\n\n")
@@ -353,21 +352,21 @@ def loadItemDb(dir):
def dumpTranslations():
for trans in oldLangFiles:
- print "old lang: " + trans
+ print("old lang: " + trans)
newFile = oldLangFiles[trans][0]
for line in newFile:
- print line
+ print(line)
if line in newFile:
- print newFile[line]
- print "\n"
+ print(newFile[line])
+ print("\n")
for trans in langFiles:
- print "new lang: " + trans
+ print("new lang: " + trans)
newFile = langFiles[trans][0]
for line in newFile:
- print line
+ print(line)
if line in newFile:
- print newFile[line]
- print "\n"
+ print(newFile[line])
+ print("\n")
def loadMobNames(dir):
@@ -392,8 +391,8 @@ collectScriptFileStrings("db/pre-re/item_db.conf", rootPath + "/db/pre-re/item_d
#collectMessages(rootPath + "/conf/messages.conf")
loadFiles(rootPath + "/langs")
addMissingLines()
-loadPoFiles("in");
-#dumpTranslations();
+loadPoFiles("in")
+#dumpTranslations()
sorting()
saveFiles(rootPath + "/langs", "out")
os.rename("out/"+defaultLang+".pot", "serverdata.pot")