From 7c995fd0e797bf7caddb0f4ddc37b5179ecde262 Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Tue, 23 Mar 2021 13:39:29 +0200 Subject: Lang: Initial version of the Finnish translation --- po/compile.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'po/compile.py') diff --git a/po/compile.py b/po/compile.py index 650dc3eb..cfe837ea 100755 --- a/po/compile.py +++ b/po/compile.py @@ -38,14 +38,28 @@ def unquote(string): def parse_po(src): messages = [] + is_multi = False msg_id, msg_str = None, None for line in open(src, 'rt', encoding='utf-8').readlines(): line = line.strip() + if is_multi: + if len(line) == 0: + if msg_id: + messages.append((msg_id, msg_str)) + is_multi = False + continue + else: + msg_str += unquote(line) if line.startswith('msgid'): msg_id = unquote(line[6:]) + elif line == 'msgstr ""': + # Multiline string. + is_multi = True + msg_str = '' elif line.startswith('msgstr'): - msg_str = unquote(line[7:]) - messages.append((msg_id, msg_str)) + msg_str = unquote(line[7:]) + if msg_id: + messages.append((msg_id, msg_str)) return messages -- cgit v1.2.3