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