Fix issue where words were getting nuked because of quotes
This commit is contained in:
parent
89ebc8008d
commit
86f7484481
1 changed files with 6 additions and 2 deletions
|
|
@ -498,8 +498,12 @@ def extractTranslation(translatedTextList, isList, pbar=None):
|
|||
if s[1:2] == "{" and s[-2:-1] == "}":
|
||||
s = s[1:-1]
|
||||
|
||||
# Normalize quotes
|
||||
s = s.replace("“", '"').replace("”", '"').replace("’", "'")
|
||||
# Normalize a broad set of Unicode “smart” quotes to ASCII equivalents.
|
||||
translation_table = {
|
||||
0x201C: '"', # “ left double quotation mark
|
||||
0x201D: '"', # ” right double quotation mark
|
||||
}
|
||||
s = s.translate(translation_table)
|
||||
|
||||
# Remove trailing commas before object/array closures
|
||||
s = re.sub(r",(\s*[}\]])", r"\1", s)
|
||||
|
|
|
|||
Loading…
Reference in a new issue