Merge pull request #1769 from Dune-jr/update-l10n-script

Fix and update convert_l10n script
This commit is contained in:
oy 2018-12-03 18:50:30 +01:00 committed by GitHub
commit 84c1972eb7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -52,7 +52,7 @@ def parse_source():
return l10n
def load_languagefile(filename):
return json.load(open(filename))
return json.load(open(filename), strict=False) # accept \t tabs
def write_languagefile(outputfilename, l10n_src, old_l10n_data):
outputfilename += '.po'
@ -110,7 +110,10 @@ if __name__ == '__main__':
'Content-Transfer-Encoding': '8bit',
}
for (msg, ctxt), occurrences in l10n_src.items():
po.append(polib.POEntry(msgid=msg, msgstr="", occurrences=occurrences, msgctxt=ctxt))
commenttxt = ctxt
if(commenttxt):
commenttxt = 'Context: '+commenttxt
po.append(polib.POEntry(msgid=msg, msgstr="", occurrences=occurrences, msgctxt=ctxt, comment=commenttxt))
po.save('data/languages/base.pot')
for filename in os.listdir("data/languages"):