aboutsummaryrefslogtreecommitdiffstats
path: root/plasma_json
diff options
context:
space:
mode:
authorYuri Chornoivan <yurchor@ukr.net>2021-01-09 12:47:37 +0200
committerYuri Chornoivan <yurchor@ukr.net>2021-01-09 12:47:37 +0200
commitc2df9e5408c172f0fc562bf3bde78382f9a0d7e3 (patch)
tree62e3d3c14b021b4d792160dd64d145c998ccf75c /plasma_json
parent0383ec743e479716f104688575c42e13ce964c0f (diff)
downloadtools-c2df9e5408c172f0fc562bf3bde78382f9a0d7e3.tar
tools-c2df9e5408c172f0fc562bf3bde78382f9a0d7e3.tar.gz
tools-c2df9e5408c172f0fc562bf3bde78382f9a0d7e3.tar.bz2
tools-c2df9e5408c172f0fc562bf3bde78382f9a0d7e3.tar.xz
tools-c2df9e5408c172f0fc562bf3bde78382f9a0d7e3.zip
Fix the script once again
Diffstat (limited to 'plasma_json')
-rw-r--r--plasma_json/po/json.pot2
-rwxr-xr-xplasma_json/po2json.py11
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()