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 = {} ...@@ -21,6 +21,13 @@ currentGroup = {}
currentId = "" currentId = ""
currentMsg = "" 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: with open(potFileName, 'r') as infile:
for line in infile.readlines(): for line in infile.readlines():
line = line.strip() line = line.strip()
...@@ -40,13 +47,9 @@ with open(potFileName, 'r') as infile: ...@@ -40,13 +47,9 @@ with open(potFileName, 'r') as infile:
parts = line.split(' ', 1) parts = line.split(' ', 1)
if len(parts) != 2: if len(parts) != 2:
continue continue
msg = parts[1].strip('\"') currentMsg = cleanupMessage(parts[1])
msg = msg.replace('\\\"', '\"')
currentMsg = msg
else: else:
msg = line.strip('\"') currentMsg += cleanupMessage(line)
msg = msg.replace('\\\"', '\"')
currentMsg += msg
outTranslations = {} 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