-
Notifications
You must be signed in to change notification settings - Fork 1
/
update.py
31 lines (22 loc) · 958 Bytes
/
update.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import logging
import os
from aseprite_ini import Aseini
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger('update')
project_root_dir = os.path.dirname(__file__)
strings_dir = os.path.join(project_root_dir, 'assets', 'strings')
data_dir = os.path.join(project_root_dir, 'data')
def main():
strings_en = Aseini.pull_strings('v1.3-rc8')
strings_en.save(os.path.join(strings_dir, 'en.ini'))
logger.info("Update strings: 'en.ini'")
zh_hant_file_path = os.path.join(data_dir, 'zh-hant.ini')
strings_zh_hant = Aseini.load(zh_hant_file_path)
strings_zh_hant.save(zh_hant_file_path, strings_en)
logger.info("Update strings: 'zh-hant.ini'")
translated, total = strings_zh_hant.coverage(strings_en)
progress = translated / total
finished_emoji = '🚩' if progress == 1 else '🚧'
print(f'progress: {translated} / {total} ({progress:.2%} {finished_emoji})')
if __name__ == '__main__':
main()