summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-03-25 09:10:24 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-03-25 09:10:24 +0200
commit14faad5c70dd50eb9cf235cef4d5ffe4415da67c (patch)
treeb17632b3ebe295bb06d4c088f5e605eb916aa145
parente544bc24b2552d826ee3d732dee59ea90e9b7e5f (diff)
Lang: Fixed plural and multiline strings
IssueID #192
-rwxr-xr-xpo/compile.py4
-rw-r--r--res/lang/de.binbin865 -> 3068 bytes
-rw-r--r--res/lang/fi.binbin14726 -> 16959 bytes
-rw-r--r--res/lang/ru.binbin20312 -> 23240 bytes
-rw-r--r--src/lang.c9
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):
48 if msg_id: 48 if msg_id:
49 messages.append((msg_id, msg_str, msg_index)) 49 messages.append((msg_id, msg_str, msg_index))
50 is_multi = False 50 is_multi = False
51 if len(line) == 0: continue
52 else: 51 else:
53 msg_str += unquote(line) 52 msg_str += unquote(line)
54 if line.startswith('msgid_plural'): 53 if line.startswith('msgid_plural'):
@@ -63,7 +62,7 @@ def parse_po(src):
63 line = line[9:] 62 line = line[9:]
64 else: 63 else:
65 msg_index = None 64 msg_index = None
66 line = line[7:] 65 line = line[6:]
67 if line.endswith(' ""'): 66 if line.endswith(' ""'):
68 is_multi = True 67 is_multi = True
69 msg_str = '' 68 msg_str = ''
@@ -77,6 +76,7 @@ def parse_po(src):
77 if not msg_index is None: 76 if not msg_index is None:
78 msg_id = f'{msg_id[:-1]}{msg_index}' 77 msg_id = f'{msg_id[:-1]}{msg_index}'
79 pluralized.append((msg_id, msg_str)) 78 pluralized.append((msg_id, msg_str))
79 #print(msg_id, '=>', msg_str)
80 return pluralized 80 return pluralized
81 81
82 82
diff --git a/res/lang/de.bin b/res/lang/de.bin
index 4b959add..9a8e509f 100644
--- a/res/lang/de.bin
+++ b/res/lang/de.bin
Binary files differ
diff --git a/res/lang/fi.bin b/res/lang/fi.bin
index 89af1575..b92470d0 100644
--- a/res/lang/fi.bin
+++ b/res/lang/fi.bin
Binary files differ
diff --git a/res/lang/ru.bin b/res/lang/ru.bin
index 67f5878e..8b75ebce 100644
--- a/res/lang/ru.bin
+++ b/res/lang/ru.bin
Binary files 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) {
71 while (*++ptr) {} 71 while (*++ptr) {}
72 msg.id.end = ptr; 72 msg.id.end = ptr;
73 msg.str.start = ++ptr; 73 msg.str.start = ++ptr;
74 while (*++ptr) {} 74 if (*ptr) { /* not empty */
75 msg.str.end = ptr; 75 while (*++ptr) {}
76 msg.str.end = ptr;
77 }
78 else {
79 msg.str = msg.id; /* not translated */
80 }
76 /* Allocate the string. The data has already been sorted. */ 81 /* Allocate the string. The data has already been sorted. */
77 printf("ID:%s\n", msg.id.start); 82 printf("ID:%s\n", msg.id.start);
78 pushBack_Array(&d->messages->values, &msg); 83 pushBack_Array(&d->messages->values, &msg);