summaryrefslogtreecommitdiff
path: root/py/makeqstrdata.py
diff options
context:
space:
mode:
authorScott Shawcroft <scott@tannewt.org>2018-08-08 18:24:49 -0700
committerScott Shawcroft <scott@tannewt.org>2018-08-09 13:29:30 -0700
commit96ebf5bc3fb455162286b9bc31e763f3c4f1c457 (patch)
tree3d06bc866bcf943a0e0ea881a1fcab9826291a1c /py/makeqstrdata.py
parent9da79c880e387ab05a683b67feb8f3da600d937d (diff)
Two fixes and translate more strings.
* Fix finding translations with escaped characters. * Add back \r to translations since its needed by screen.
Diffstat (limited to 'py/makeqstrdata.py')
-rw-r--r--py/makeqstrdata.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/py/makeqstrdata.py b/py/makeqstrdata.py
index 719bc62fa..fd41e3b0e 100644
--- a/py/makeqstrdata.py
+++ b/py/makeqstrdata.py
@@ -66,7 +66,7 @@ def translate(translation_file, i18ns):
with open(translation_file, "rb") as f:
table = gettext.GNUTranslations(f)
- return [(x, table.gettext(x)) for x in i18ns]
+ return [(x, table.gettext(x.decode('string_escape'))) for x in i18ns]
def qstr_escape(qst):
def esc_char(m):
@@ -181,6 +181,8 @@ def print_qstr_data(qcfgs, qstrs, i18ns):
total_text_size = 0
for original, translation in i18ns:
+ # Add in carriage returns to work in terminals
+ translation = translation.replace("\n", "\\r\\n")
print("TRANSLATION(\"{}\", \"{}\")".format(original, translation))
total_text_size += len(translation)