1
0
mirror of https://github.com/libretro/RetroArch synced 2024-07-05 09:48:42 +00:00
RetroArch/intl/fetch_progress.py
2020-06-04 12:40:25 +03:00

18 lines
763 B
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)
r = requests.get('https://api.crowdin.com/api/project/' + config['project_identifier'] + '/status?key=' + config['api_key'] + '&json')
output = ''
for lang in r.json():
output += '/* ' + lang['name'] + ' */\n'
escaped_name = lang['name'].replace(', ', '_').replace(' ', '_').upper()
output += '#define LANGUAGE_PROGRESS_' + escaped_name + '_TRANSLATED ' + str(lang['translated_progress']) + '\n'
output += '#define LANGUAGE_PROGRESS_' + escaped_name + '_APPROVED ' + str(lang['approved_progress']) + '\n\n'
with open("progress.h", 'w') as output_file:
output_file.write(output)