Commit 36775d15 authored by David Edmundson's avatar David Edmundson

[convertpottojson] Handle lines ending with "

the .pot file has lines starting and ending in quotes
we used strip(\") to get rid of them.

If a string ends in ", it will appear as "" in the file, and both
characters get stripped.

Instead chop the first and last characters
parent 84049bf5
......@@ -21,6 +21,13 @@ currentGroup = {}
currentId = ""
currentMsg = ""
def cleanupMessage(msg):
# strip wrapping "'s
msg = msg[1:-1]
# unescape quotes in the pot file
msg = msg.replace('\\\"', '\"')
return msg
with open(potFileName, 'r') as infile:
for line in infile.readlines():
line = line.strip()
......@@ -40,13 +47,9 @@ with open(potFileName, 'r') as infile:
parts = line.split(' ', 1)
if len(parts) != 2:
continue
msg = parts[1].strip('\"')
msg = msg.replace('\\\"', '\"')
currentMsg = msg
currentMsg = cleanupMessage(parts[1])
else:
msg = line.strip('\"')
msg = msg.replace('\\\"', '\"')
currentMsg += msg
currentMsg += cleanupMessage(line)
outTranslations = {}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment