Fix crowdin upload
This commit is contained in:
@@ -28,11 +28,11 @@ os.system(cmd)
|
|||||||
os.chdir('lib')
|
os.chdir('lib')
|
||||||
|
|
||||||
crowdin_identifier = 'electrum'
|
crowdin_identifier = 'electrum'
|
||||||
crowdin_file_name = 'electrum-client/messages.pot'
|
crowdin_file_name = 'files[electrum-client/messages.pot]'
|
||||||
locale_file_name = 'locale/messages.pot'
|
locale_file_name = 'locale/messages.pot'
|
||||||
crowdin_api_key = None
|
crowdin_api_key = None
|
||||||
|
|
||||||
filename = '~/.crowdin_api_key'
|
filename = os.path.expanduser('~/.crowdin_api_key')
|
||||||
if os.path.exists(filename):
|
if os.path.exists(filename):
|
||||||
with open(filename) as f:
|
with open(filename) as f:
|
||||||
crowdin_api_key = f.read().strip()
|
crowdin_api_key = f.read().strip()
|
||||||
@@ -44,13 +44,14 @@ if crowdin_api_key:
|
|||||||
# Push to Crowdin
|
# Push to Crowdin
|
||||||
print('Push to Crowdin')
|
print('Push to Crowdin')
|
||||||
url = ('https://api.crowdin.com/api/project/' + crowdin_identifier + '/update-file?key=' + crowdin_api_key)
|
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}
|
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
|
# Build translations
|
||||||
print('Build translations')
|
print('Build translations')
|
||||||
response = requests.request('GET', 'https://api.crowdin.com/api/project/' + crowdin_identifier + '/export?key=' + crowdin_api_key).content
|
response = requests.request('GET', 'https://api.crowdin.com/api/project/' + crowdin_identifier + '/export?key=' + crowdin_api_key)
|
||||||
print(response)
|
print("", "export:", "-" * 20, response.text, "-" * 20, sep="\n")
|
||||||
|
|
||||||
# Download & unzip
|
# Download & unzip
|
||||||
print('Download translations')
|
print('Download translations')
|
||||||
|
|||||||
Reference in New Issue
Block a user