strip whitespace in extracted strings

This commit is contained in:
Damien Elmes 2020-02-27 17:38:02 +10:00
parent da86c27d05
commit f4d38f579d

View file

@ -37,7 +37,7 @@ def get_msgstr(entry):
if replacements: if replacements:
for (old, new) in replacements: for (old, new) in replacements:
msg = msg.replace(old, f"{{{new}}}") msg = msg.replace(old, f"{{{new}}}")
return msg return msg.strip()
# plural string and non-empty? # plural string and non-empty?
elif entry.msgstr_plural and entry.msgstr_plural[0]: elif entry.msgstr_plural and entry.msgstr_plural[0]:
# convert the dict into a list in the correct order # convert the dict into a list in the correct order
@ -49,7 +49,7 @@ def get_msgstr(entry):
if replacements: if replacements:
for (old, new) in replacements: for (old, new) in replacements:
msg = msg.replace(old, f"{{{new}}}") msg = msg.replace(old, f"{{{new}}}")
adjusted.append(msg) adjusted.append(msg.strip())
if len(adjusted) > 1 and adjusted[0]: if len(adjusted) > 1 and adjusted[0]:
return adjusted return adjusted
else: else: