fix: Update translation scripts (#32)
* fix: Update translation scripts * fix: Remove useless importpull/3756/head
parent
63cb36ed41
commit
29ac470bc5
|
@ -21,8 +21,12 @@ def flatten(data):
|
||||||
|
|
||||||
return flattened
|
return flattened
|
||||||
|
|
||||||
key_query = '?key=' + main['key']
|
headers = {
|
||||||
response = requests.get(main['host'] + '/api/v3/brands/' + main['brand'] + '/languages/' + source_locale + '/dictionary' + key_query)
|
'accept': 'application/json',
|
||||||
|
'x-api-key': main['key'],
|
||||||
|
}
|
||||||
|
|
||||||
|
response = requests.get(main['host'] + '/api/v3/brands/' + main['brand'] + '/languages/' + source_locale + '/dictionary', headers=headers)
|
||||||
if response.status_code != 200:
|
if response.status_code != 200:
|
||||||
print('could not fetch existing messages')
|
print('could not fetch existing messages')
|
||||||
exit()
|
exit()
|
||||||
|
@ -35,8 +39,7 @@ f.close()
|
||||||
|
|
||||||
flattened = flatten(data)
|
flattened = flatten(data)
|
||||||
|
|
||||||
url = main['host'] + '/api/v2/messages' + key_query
|
url = main['host'] + '/api/v2/messages'
|
||||||
headers = {'accept': 'application/json'}
|
|
||||||
|
|
||||||
for key, value in flattened.items():
|
for key, value in flattened.items():
|
||||||
if key in messages:
|
if key in messages:
|
||||||
|
|
|
@ -41,10 +41,12 @@ config = configparser.ConfigParser()
|
||||||
config.read('config')
|
config.read('config')
|
||||||
main = config['main']
|
main = config['main']
|
||||||
|
|
||||||
key_query = '?key=' + main['key']
|
headers = {
|
||||||
headers = {'accept': 'application/json'}
|
'accept': 'application/json',
|
||||||
|
'x-api-key': main['key'],
|
||||||
|
}
|
||||||
|
|
||||||
response = requests.get(main['host'] + '/api/v2/brands/' + main['brand'] + '/languages' + key_query, headers=headers)
|
response = requests.get(main['host'] + '/api/v2/brands/' + main['brand'] + '/languages', headers=headers)
|
||||||
if response.status_code != 200:
|
if response.status_code != 200:
|
||||||
raise Exception('Could not fetch brand languages')
|
raise Exception('Could not fetch brand languages')
|
||||||
|
|
||||||
|
@ -52,7 +54,7 @@ languages = json.loads(response.text)
|
||||||
|
|
||||||
for language in languages:
|
for language in languages:
|
||||||
print(language['code'])
|
print(language['code'])
|
||||||
response = requests.get(main['host'] + '/api/v3/brands/' + main['brand'] + '/languages/' + language['code'] + '/dictionary' + key_query + '&fallback_locale=en_GB')
|
response = requests.get(main['host'] + '/api/v3/brands/' + main['brand'] + '/languages/' + language['code'] + '/dictionary?fallback_locale=en_GB', headers=headers)
|
||||||
if response.status_code != 200:
|
if response.status_code != 200:
|
||||||
print('could not fetch translations for messages: %s' % language['code'])
|
print('could not fetch translations for messages: %s' % language['code'])
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -73,11 +73,11 @@
|
||||||
"metadata": "Метаданные",
|
"metadata": "Метаданные",
|
||||||
"multipleSelectionEnabled": "Мультивыбор включен",
|
"multipleSelectionEnabled": "Мультивыбор включен",
|
||||||
"name": "Имя",
|
"name": "Имя",
|
||||||
|
"noPreview": "Preview is not available for this file.",
|
||||||
"size": "Размер",
|
"size": "Размер",
|
||||||
"sortByLastModified": "Сортировка по дате изменения",
|
"sortByLastModified": "Сортировка по дате изменения",
|
||||||
"sortByName": "Сортировка по имени",
|
"sortByName": "Сортировка по имени",
|
||||||
"sortBySize": "Сортировка по размеру",
|
"sortBySize": "Сортировка по размеру"
|
||||||
"noPreview": "Предварительный просмотр для этого файла недоступен."
|
|
||||||
},
|
},
|
||||||
"help": {
|
"help": {
|
||||||
"click": "выбрать файл или каталог",
|
"click": "выбрать файл или каталог",
|
||||||
|
|
Loading…
Reference in New Issue