diff options
Diffstat (limited to 'web/legacy')
-rwxr-xr-x | web/legacy | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/web/legacy b/web/legacy new file mode 100755 index 0000000..4629a06 --- /dev/null +++ b/web/legacy @@ -0,0 +1,51 @@ +#! /usr/bin/env python2.7 +# -*- coding: utf8 -*- +# +# Copyright (C) 2018 TMW-2 +# Author: Jesusalva + +import os +import re + +defaultLang = "en" + +rootPath = "../../web/" + +filt = re.compile(".+[.]php", re.IGNORECASE) + +allFiles=[] +langFiles = dict() +langs = [] # Current languages + +# Read languages +o=open("langs.txt", "r") +for i in o: + langs.append(i.replace('\n','')) +o.close() + +# Read PHP files, and create langFiles[i]["master"] +for i in os.listdir(rootPath): + if i.endswith(".php"): + langFiles[i]={} + o=open(rootPath+'/'+i, 'r') + for line in o: + langFiles[i]["master"]=line + o.close() + +# Sort each language for stuff +for a in langFiles: + for b in langs: + langFiles[a][b]=[] + + cnt=0 + pot=open("po/"+b+".po", "r") + for line in pot: + if "msgstr" in line: + abaco=str(line.replace('msgstr "','')[:-1]) + if abaco != "": + langFiles[a][b].append(abaco) + else: + langFiles[a][b].append(langFiles[a][master][cnt]) + cnt+=1 + + print str(langFiles[a][b]) |