Create translation progress dump script and add to appveryor build (travis soon)
This commit is contained in:
@@ -55,6 +55,8 @@ build_script:
|
||||
- ps: echo("Build pyfa:")
|
||||
# Build language files
|
||||
- cmd: "python scripts/compile_lang.py"
|
||||
# Dump language progress
|
||||
- cmd: "python scripts/dump_crowdin_progress.py"
|
||||
# Build gamedata DB
|
||||
- cmd: "python db_update.py"
|
||||
# Build command for PyInstaller
|
||||
|
||||
29
scripts/dump_crowdin_progress.py
Normal file
29
scripts/dump_crowdin_progress.py
Normal file
@@ -0,0 +1,29 @@
|
||||
import requests
|
||||
import os
|
||||
import json
|
||||
import wx
|
||||
|
||||
key = os.environ.get("CROWDIN_APPI_KEY", "")
|
||||
|
||||
params = {
|
||||
'json': '',
|
||||
'key': key
|
||||
}
|
||||
|
||||
resp = requests.get('https://api.crowdin.com/api/project/pyfa/status', params=params)
|
||||
data = resp.json()
|
||||
|
||||
for x in data:
|
||||
x['code'] = x['code'].replace('-', '_')
|
||||
lang = wx.Locale.FindLanguageInfo(x['code'])
|
||||
if lang is None:
|
||||
print('Cannot find a match for '+x['code'])
|
||||
continue
|
||||
x['canonical_name'] = lang.CanonicalName
|
||||
|
||||
data = {x['canonical_name']: x for x in data}
|
||||
|
||||
with open("locale/progress.json", 'w') as file:
|
||||
file.seek(0)
|
||||
file.truncate()
|
||||
json.dump(data, file)
|
||||
Reference in New Issue
Block a user