summaryrefslogtreecommitdiff
path: root/web/updatelang.py
diff options
context:
space:
mode:
Diffstat (limited to 'web/updatelang.py')
-rwxr-xr-xweb/updatelang.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/web/updatelang.py b/web/updatelang.py
index 11ee54e..6b8c548 100755
--- a/web/updatelang.py
+++ b/web/updatelang.py
@@ -14,7 +14,7 @@ rootPath = "../../site/i18n/"
langs=[]
files={}
originals={}
-tm=["","\n"]
+tm={defaultLang: ["","\n"]}
# Search for array[?]==search in an array of dicts
# Returns the dictionary, or returns "ERROR"
@@ -60,6 +60,7 @@ def init():
# Create each language's template
for i in langs:
files[str(i)]=copy.copy(originals)
+ tm[str(i)]=["","\n"]
"""
# Do the reading for each language
@@ -85,8 +86,8 @@ def lgname(lg):
return "Unknown %s" % lg
# [OK] Entry
-def poentry(org, ttl):
- return polib.POEntry(msgid=org, msgstr=ttl)
+def poentry(org, ttl, comments):
+ return polib.POEntry(msgid=org, msgstr=ttl, comment=comments)
# Creates/Loads stuff
def generatePoFiles():
@@ -108,10 +109,16 @@ def generatePoFiles():
}
for key, speech in originals.items():
+ # Translation Memory (no duplicates)
+ if speech in tm[lg]:
+ continue
+ tm[lg].append(speech)
+
+ # Add to po file
if lg == "en":
- po.append(poentry(speech, ""))
+ po.append(poentry(speech, "", key))
else:
- po.append(poentry(speech, files[lg][key]))
+ po.append(poentry(speech, files[lg][key], key))
po.save("po/%s.po" % lg)
context.remove('en')