Browse Source

Fix crowdin upload

3.2.x
Johann Bauer 7 years ago
parent
commit
79edd2dbf1
No known key found for this signature in database GPG Key ID: 84F1BF925B1F484D
  1. 13
      contrib/make_locale

13
contrib/make_locale

@ -28,11 +28,11 @@ os.system(cmd)
os.chdir('lib')
crowdin_identifier = 'electrum'
crowdin_file_name = 'electrum-client/messages.pot'
crowdin_file_name = 'files[electrum-client/messages.pot]'
locale_file_name = 'locale/messages.pot'
crowdin_api_key = None
filename = '~/.crowdin_api_key'
filename = os.path.expanduser('~/.crowdin_api_key')
if os.path.exists(filename):
with open(filename) as f:
crowdin_api_key = f.read().strip()
@ -44,13 +44,14 @@ if crowdin_api_key:
# Push to Crowdin
print('Push to Crowdin')
url = ('https://api.crowdin.com/api/project/' + crowdin_identifier + '/update-file?key=' + crowdin_api_key)
with open(locale_file_name,'rb') as f:
with open(locale_file_name, 'rb') as f:
files = {crowdin_file_name: f}
requests.request('POST', url, files=files)
response = requests.request('POST', url, files=files)
print("", "update-file:", "-"*20, response.text, "-"*20, sep="\n")
# Build translations
print('Build translations')
response = requests.request('GET', 'https://api.crowdin.com/api/project/' + crowdin_identifier + '/export?key=' + crowdin_api_key).content
print(response)
response = requests.request('GET', 'https://api.crowdin.com/api/project/' + crowdin_identifier + '/export?key=' + crowdin_api_key)
print("", "export:", "-" * 20, response.text, "-" * 20, sep="\n")
# Download & unzip
print('Download translations')

Loading…
Cancel
Save