diff options
Diffstat (limited to 'web/updatelang.py')
-rwxr-xr-x | web/updatelang.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/web/updatelang.py b/web/updatelang.py index f38b2fb..e02d061 100755 --- a/web/updatelang.py +++ b/web/updatelang.py @@ -12,6 +12,7 @@ rootPath = "../../web/" langs=[] files={} originals={} +tm=["","\n"] # Populates the basic arrays def populate(): @@ -40,6 +41,7 @@ def genreadPoFile(): readPoFile(i,a) def generatePoFiles(): + global tm context=langs context.append('en') for a in langs: @@ -60,6 +62,7 @@ msgstr ""\n\ ') xrv.close() + tm=[""] for i in files: writePoFile(i,a) context.remove('en') @@ -74,10 +77,18 @@ def generateLocal(): # Write po files def writePoFile(nf,lg): + # Translation Memory, to prevent duplicates + global tm + a=open("po/"+lg+".po", "a") f=open(rootPath+nf, "r") for line in f: + if line in tm or line.startswith("include ") or line.startswith("<?php") or line.startswith("?>") or "<div " in line or "</div>" in line or "iframe" in line or line.replace('\n','') == "": + continue + else: + tm.append(line) + a.write("#, no-c-format\n") a.write('msgid "%s"\n' % line.replace('\n', '').replace('"','\\"')) try: |