diff options
Diffstat (limited to 'po/compile.py')
-rwxr-xr-x | po/compile.py | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/po/compile.py b/po/compile.py index f046ca96..adf5a403 100755 --- a/po/compile.py +++ b/po/compile.py | |||
@@ -4,8 +4,8 @@ | |||
4 | 4 | ||
5 | import os, sys | 5 | import os, sys |
6 | 6 | ||
7 | BUILD_LANGS = [ | 7 | BUILD_LANGS = [ 'en', # base strings |
8 | 'en', # base strings | 8 | 'cs', |
9 | 'de', | 9 | 'de', |
10 | 'eo', | 10 | 'eo', |
11 | 'es', | 11 | 'es', |
@@ -35,6 +35,9 @@ ESCAPES = { | |||
35 | 't': '\t', | 35 | 't': '\t', |
36 | 'v': '\v', | 36 | 'v': '\v', |
37 | } | 37 | } |
38 | missing_count = {} | ||
39 | for lang in BUILD_LANGS: | ||
40 | missing_count[lang] = 0 | ||
38 | 41 | ||
39 | if '--new' in sys.argv: | 42 | if '--new' in sys.argv: |
40 | MODE = 'new' | 43 | MODE = 'new' |
@@ -122,6 +125,7 @@ if MODE == 'compile': | |||
122 | for src in os.listdir('.'): | 125 | for src in os.listdir('.'): |
123 | if src.endswith('.po') and src.split('.')[0] in BUILD_LANGS: | 126 | if src.endswith('.po') and src.split('.')[0] in BUILD_LANGS: |
124 | # Make a binary blob with strings sorted by ID. | 127 | # Make a binary blob with strings sorted by ID. |
128 | lang_id = src[:-3] | ||
125 | have_ids = set() | 129 | have_ids = set() |
126 | compiled = bytes() | 130 | compiled = bytes() |
127 | lang = parse_po(src) | 131 | lang = parse_po(src) |
@@ -130,11 +134,16 @@ if MODE == 'compile': | |||
130 | # Take missing strings from the base language. | 134 | # Take missing strings from the base language. |
131 | for msg_id in BASE_STRINGS: | 135 | for msg_id in BASE_STRINGS: |
132 | if msg_id not in have_ids and not msg_id[:-2] in PLURALS: | 136 | if msg_id not in have_ids and not msg_id[:-2] in PLURALS: |
133 | print('%10s' % src, 'missing:', msg_id) | 137 | #print('%10s' % src, 'missing:', msg_id) |
138 | missing_count[lang_id] += 1 | ||
134 | lang.append((msg_id, BASE_STRINGS[msg_id])) | 139 | lang.append((msg_id, BASE_STRINGS[msg_id])) |
135 | for msg_id, msg_str in sorted(lang): | 140 | for msg_id, msg_str in sorted(lang): |
136 | compiled += compile_string(msg_id, msg_str) | 141 | compiled += compile_string(msg_id, msg_str) |
137 | open(f'../res/lang/{src[:-3]}.bin', 'wb').write(compiled) | 142 | open(f'../res/lang/{lang_id}.bin', 'wb').write(compiled) |
143 | # Show statistics. | ||
144 | for lang_id in missing_count: | ||
145 | if missing_count[lang_id] > 0: | ||
146 | print('%7s: %4d missing' % (lang_id, missing_count[lang_id])) | ||
138 | 147 | ||
139 | elif MODE == 'new': | 148 | elif MODE == 'new': |
140 | messages = parse_po('en.po') | 149 | messages = parse_po('en.po') |