diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-03-23 13:39:29 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-03-23 13:39:29 +0200 |
commit | 7c995fd0e797bf7caddb0f4ddc37b5179ecde262 (patch) | |
tree | cdea4b7835ecbaf0cc07190ce926202a0d7ad184 /po/compile.py | |
parent | 60bdfa5b64261e02a7852bf6adebd6dba82de8b0 (diff) |
Lang: Initial version of the Finnish translation
Diffstat (limited to 'po/compile.py')
-rwxr-xr-x | po/compile.py | 18 |
1 files changed, 16 insertions, 2 deletions
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): | |||
38 | 38 | ||
39 | def parse_po(src): | 39 | def parse_po(src): |
40 | messages = [] | 40 | messages = [] |
41 | is_multi = False | ||
41 | msg_id, msg_str = None, None | 42 | msg_id, msg_str = None, None |
42 | for line in open(src, 'rt', encoding='utf-8').readlines(): | 43 | for line in open(src, 'rt', encoding='utf-8').readlines(): |
43 | line = line.strip() | 44 | line = line.strip() |
45 | if is_multi: | ||
46 | if len(line) == 0: | ||
47 | if msg_id: | ||
48 | messages.append((msg_id, msg_str)) | ||
49 | is_multi = False | ||
50 | continue | ||
51 | else: | ||
52 | msg_str += unquote(line) | ||
44 | if line.startswith('msgid'): | 53 | if line.startswith('msgid'): |
45 | msg_id = unquote(line[6:]) | 54 | msg_id = unquote(line[6:]) |
55 | elif line == 'msgstr ""': | ||
56 | # Multiline string. | ||
57 | is_multi = True | ||
58 | msg_str = '' | ||
46 | elif line.startswith('msgstr'): | 59 | elif line.startswith('msgstr'): |
47 | msg_str = unquote(line[7:]) | 60 | msg_str = unquote(line[7:]) |
48 | messages.append((msg_id, msg_str)) | 61 | if msg_id: |
62 | messages.append((msg_id, msg_str)) | ||
49 | return messages | 63 | return messages |
50 | 64 | ||
51 | 65 | ||