diff options
author | Yuri Chornoivan <yurchor@ukr.net> | 2021-01-09 10:33:56 +0200 |
---|---|---|
committer | Yuri Chornoivan <yurchor@ukr.net> | 2021-01-09 10:33:56 +0200 |
commit | 4902635a604a4cc724e72049431f2402af385836 (patch) | |
tree | 5c49c10779ce1b1e58317a1059b957946bf7594f /plasma_json/po2json.py | |
parent | 85005babd41f20fefae33147f708a1167c0d7f80 (diff) | |
download | tools-4902635a604a4cc724e72049431f2402af385836.tar tools-4902635a604a4cc724e72049431f2402af385836.tar.gz tools-4902635a604a4cc724e72049431f2402af385836.tar.bz2 tools-4902635a604a4cc724e72049431f2402af385836.tar.xz tools-4902635a604a4cc724e72049431f2402af385836.zip |
Fix the script to obtain the valid JSON
Diffstat (limited to 'plasma_json/po2json.py')
-rwxr-xr-x | plasma_json/po2json.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/plasma_json/po2json.py b/plasma_json/po2json.py index 1740a044..98319557 100755 --- a/plasma_json/po2json.py +++ b/plasma_json/po2json.py @@ -111,8 +111,11 @@ for langfile in files: for entry in po.translated_entries(): for line in lines: if entry.msgid in line: - indent = line.replace('\"' + entry.msgctxt + '\": \"' + entry.msgid + '\",', '') - origandtranslated = line + '\n' + indent + '\"' + entry.msgctxt + '[' + lang + ']' + '\": \"' + entry.msgstr + '\",' + indent = line.replace('\"' + entry.msgctxt + '\": \"' + entry.msgid + '\"', '').strip(',') + if '}' in lines[lines.index(line) + 1]: + origandtranslated = line + '\n' + indent + '\"' + entry.msgctxt + '[' + lang + ']' + '\": \"' + entry.msgstr + '\"' + else: + origandtranslated = line + '\n' + indent + '\"' + entry.msgctxt + '[' + lang + ']' + '\": \"' + entry.msgstr + '\",' text = text.replace(line, origandtranslated) jsonfile.write(text) |