mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-27 10:10:57 +00:00
6ad91b2b37
* Create crowdin-daily.yml * Update crowdin.yaml * Update crowdin_sync.py * Update fetch_progress.py
26 lines
1.1 KiB
Python
Executable File
26 lines
1.1 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
import requests
|
|
|
|
import yaml
|
|
|
|
with open("crowdin.yaml", 'r') as config_file:
|
|
config = yaml.safe_load(config_file)
|
|
headers = { 'Authorization': 'Bearer ' + config['api_token']}
|
|
|
|
url1 = 'https://api.crowdin.com/api/v2/projects/' + config['project_id'] + '/languages/progress?limit=100'
|
|
res1 = requests.get(url1, headers=headers)
|
|
output = ''
|
|
for lang in res1.json()['data']:
|
|
lang_id = lang['data']['languageId']
|
|
url2 = 'https://api.crowdin.com/api/v2/languages/' + lang_id
|
|
res2 = requests.get(url2, headers=headers)
|
|
lang_name = res2.json()['data']['name']
|
|
|
|
output += '/* ' + lang_name + ' */\n'
|
|
escaped_name = lang_name.replace(', ', '_').replace(' ', '_').upper()
|
|
output += '#define LANGUAGE_PROGRESS_' + escaped_name + '_TRANSLATED ' + str(lang['data']['translationProgress']) + '\n'
|
|
output += '#define LANGUAGE_PROGRESS_' + escaped_name + '_APPROVED ' + str(lang['data']['approvalProgress']) + '\n\n'
|
|
with open("progress.h", 'w') as output_file:
|
|
output_file.write(output)
|