diff options
Diffstat (limited to 'plasma_json')
-rw-r--r-- | plasma_json/po/json.pot | 2 | ||||
-rwxr-xr-x | plasma_json/po2json.py | 11 |
2 files changed, 8 insertions, 5 deletions
diff --git a/plasma_json/po/json.pot b/plasma_json/po/json.pot index cd688a02..e7157b4e 100644 --- a/plasma_json/po/json.pot +++ b/plasma_json/po/json.pot @@ -3,7 +3,7 @@ msgid "" msgstr "" "Project-Id-Version: Mageia json files translation\n" "Report-Msgid-Bugs-To: i18n-discuss@ml.mageia.org\n" -"POT-Creation-Date: 2021-01-09 12:27+0200\n" +"POT-Creation-Date: 2021-01-09 12:46+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/plasma_json/po2json.py b/plasma_json/po2json.py index 98319557..3b375808 100755 --- a/plasma_json/po2json.py +++ b/plasma_json/po2json.py @@ -112,12 +112,15 @@ for langfile in files: for line in lines: if entry.msgid in line: 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 + '\",' + origandtranslated = line + '\n' + indent + '\"' + entry.msgctxt + '[' + lang + ']' + '\": \"' + entry.msgstr + '\",' text = text.replace(line, origandtranslated) + # Remove extra commas + lines = text.split('\n') + for line in lines: + if (line.endswith(',')) and ('}' in lines[lines.index(line) + 1]): + text = text.replace(line, line[:-1]) + jsonfile.write(text) jsonfile.close() |