From 14faad5c70dd50eb9cf235cef4d5ffe4415da67c Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Thu, 25 Mar 2021 09:10:24 +0200 Subject: Lang: Fixed plural and multiline strings IssueID #192 --- po/compile.py | 4 ++-- res/lang/de.bin | Bin 865 -> 3068 bytes res/lang/fi.bin | Bin 14726 -> 16959 bytes res/lang/ru.bin | Bin 20312 -> 23240 bytes src/lang.c | 9 +++++++-- 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/po/compile.py b/po/compile.py index 0a0eab91..6416ea0e 100755 --- a/po/compile.py +++ b/po/compile.py @@ -48,7 +48,6 @@ def parse_po(src): if msg_id: messages.append((msg_id, msg_str, msg_index)) is_multi = False - if len(line) == 0: continue else: msg_str += unquote(line) if line.startswith('msgid_plural'): @@ -63,7 +62,7 @@ def parse_po(src): line = line[9:] else: msg_index = None - line = line[7:] + line = line[6:] if line.endswith(' ""'): is_multi = True msg_str = '' @@ -77,6 +76,7 @@ def parse_po(src): if not msg_index is None: msg_id = f'{msg_id[:-1]}{msg_index}' pluralized.append((msg_id, msg_str)) + #print(msg_id, '=>', msg_str) return pluralized diff --git a/res/lang/de.bin b/res/lang/de.bin index 4b959add..9a8e509f 100644 Binary files a/res/lang/de.bin and b/res/lang/de.bin differ diff --git a/res/lang/fi.bin b/res/lang/fi.bin index 89af1575..b92470d0 100644 Binary files a/res/lang/fi.bin and b/res/lang/fi.bin differ diff --git a/res/lang/ru.bin b/res/lang/ru.bin index 67f5878e..8b75ebce 100644 Binary files a/res/lang/ru.bin and b/res/lang/ru.bin differ diff --git a/src/lang.c b/src/lang.c index 983ae3c5..5399d97b 100644 --- a/src/lang.c +++ b/src/lang.c @@ -71,8 +71,13 @@ static void load_Lang_(iLang *d, const char *id) { while (*++ptr) {} msg.id.end = ptr; msg.str.start = ++ptr; - while (*++ptr) {} - msg.str.end = ptr; + if (*ptr) { /* not empty */ + while (*++ptr) {} + msg.str.end = ptr; + } + else { + msg.str = msg.id; /* not translated */ + } /* Allocate the string. The data has already been sorted. */ printf("ID:%s\n", msg.id.start); pushBack_Array(&d->messages->values, &msg); -- cgit v1.2.3