summaryrefslogtreecommitdiff
path: root/lang/converttopo.py
diff options
context:
space:
mode:
Diffstat (limited to 'lang/converttopo.py')
-rwxr-xr-xlang/converttopo.py108
1 files changed, 54 insertions, 54 deletions
diff --git a/lang/converttopo.py b/lang/converttopo.py
index 1e6332d..279e09f 100755
--- a/lang/converttopo.py
+++ b/lang/converttopo.py
@@ -22,69 +22,69 @@ itemNamesByName = dict()
def loadFiles(dir):
- with open(dir + "/langs.txt", "r") as f:
- for line in f:
- langs.add(line[:-1])
+ with open(dir + "/langs.txt", "r") as f:
+ for line in f:
+ langs.add(line[:-1])
- for file in langs:
- if file == "en":
- langFiles[file] = parseFile(dir + "/lang_" + file + ".txt", True, True)
- else:
- langFiles[file] = parseFile(dir + "/lang_" + file + ".txt", True, False)
+ for file in langs:
+ if file == "en":
+ langFiles[file] = parseFile(dir + "/lang_" + file + ".txt", True, True)
+ else:
+ langFiles[file] = parseFile(dir + "/lang_" + file + ".txt", True, False)
def parseFile(name, readFirstLine, isBaseLang):
- trans = dict()
- firstLine = None
- if os.path.exists(name):
- with open(name, "r") as f:
- line1 = "";
- line2 = "";
- for line in f:
- if readFirstLine is True and firstLine is None:
- firstLine = line
- continue
-
- if (line == ""):
- line1 = ""
- line2 = ""
- continue
- elif (line1 == ""):
- line1 = line[:-1]
- continue
-
- line2 = line[:-1]
- if isBaseLang:
- trans[line1] = line1
- else:
- trans[line1] = line2
- line1 = ""
- line2 = ""
- return (trans, firstLine)
+ trans = dict()
+ firstLine = None
+ if os.path.exists(name):
+ with open(name, "r") as f:
+ line1 = "";
+ line2 = "";
+ for line in f:
+ if readFirstLine is True and firstLine is None:
+ firstLine = line
+ continue
+
+ if (line == ""):
+ line1 = ""
+ line2 = ""
+ continue
+ elif (line1 == ""):
+ line1 = line[:-1]
+ continue
+
+ line2 = line[:-1]
+ if isBaseLang:
+ trans[line1] = line1
+ else:
+ trans[line1] = line2
+ line1 = ""
+ line2 = ""
+ return (trans, firstLine)
def saveFiles(name):
- for filen in langFiles:
- saveFile(name, filen)
+ for filen in langFiles:
+ saveFile(name, filen)
def saveFile(path, name):
- print str(name)
- with open (path + "/" + name + ".po", "w") as w:
- lang = langFiles[name]
- w.write ("# " + lang[1] + "")
- w.write ("#\n\n")
- w.write ("msgid \"\"\n")
- w.write ("msgstr \"\"\n")
- w.write ("\"Project-Id-Version: EvolOnline\\n\"\n")
- w.write ("\"MIME-Version: 1.0\\n\"\n")
- w.write ("\"Content-Type: text/plain; charset=UTF-8\\n\"\n")
- w.write ("\"Content-Transfer-Encoding: 8bit\\n\"\n")
- w.write ("\n")
- for line in lang[0].keys():
- line2 = line.replace("\"", "\\\"")
- w.write ("msgid \"" + line2 + "\"\n")
- line2 = lang[0][line].replace("\"", "\\\"")
- w.write ("msgstr \"" + line2 + "\"\n\n")
+ print str(name)
+ with open (path + "/" + name + ".po", "w") as w:
+ lang = langFiles[name]
+ w.write ("# " + lang[1] + "")
+ w.write ("#\n\n")
+ w.write ("msgid \"\"\n")
+ w.write ("msgstr \"\"\n")
+ w.write ("\"Project-Id-Version: EvolOnline\\n\"\n")
+ w.write ("\"MIME-Version: 1.0\\n\"\n")
+ w.write ("\"Content-Type: text/plain; charset=UTF-8\\n\"\n")
+ w.write ("\"Content-Transfer-Encoding: 8bit\\n\"\n")
+ w.write ("\n")
+ for line in lang[0].keys():
+ line2 = line.replace("\"", "\\\"")
+ w.write ("msgid \"" + line2 + "\"\n")
+ line2 = lang[0][line].replace("\"", "\\\"")
+ w.write ("msgstr \"" + line2 + "\"\n\n")
rootPath = "../../server-data"