From d041de5603b858f7c68b3d7b72c4071245567b02 Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Sun, 28 Mar 2021 10:00:57 +0300 Subject: Lang: Recompiled language strings --- po/compile.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'po/compile.py') diff --git a/po/compile.py b/po/compile.py index a78859a4..373fdcf9 100755 --- a/po/compile.py +++ b/po/compile.py @@ -13,7 +13,6 @@ ESCAPES = { 'r': '\r', 't': '\t' } -BASE_STRINGS = {} if '--new' in sys.argv: MODE = 'new' @@ -85,11 +84,15 @@ def parse_po(src): def compile_string(msg_id, msg_str): return msg_id.encode('utf-8') + bytes([0]) + \ msg_str.encode('utf-8') + bytes([0]) - + if MODE == 'compile': + BASE_STRINGS = {} + PLURALS = set() for msg_id, msg_str in parse_po('en.po'): BASE_STRINGS[msg_id] = msg_str + if msg_id.endswith('.0'): + PLURALS.add(msg_id[:-2]) for src in os.listdir('.'): if src.endswith('.po') and src.split('.')[0] in BUILD_LANGS: # Make a binary blob with strings sorted by ID. @@ -100,7 +103,7 @@ if MODE == 'compile': have_ids.add(msg_id) # Take missing strings from the base language. for msg_id in BASE_STRINGS: - if msg_id not in have_ids: + if msg_id not in have_ids and not msg_id[:-2] in PLURALS: print(src, 'missing:', msg_id) lang.append((msg_id, BASE_STRINGS[msg_id])) for msg_id, msg_str in sorted(lang): -- cgit v1.2.3