@@ -9,3 +9,5 @@ dist/**/*.woff binary | |||||
dist/**/*.woff2 binary | dist/**/*.woff2 binary | ||||
dist/**/*.png binary | dist/**/*.png binary | ||||
dist/*.html text | dist/*.html text | ||||
src/main/html/images/*.png binary |
@@ -131,7 +131,7 @@ swaggerUi.api.clientAuthorizations.add("key", new SwaggerClient.ApiKeyAuthorizat | |||||
Note! You can pass multiple header params on a single request, just use unique names for them (`key` is used in the above example). | Note! You can pass multiple header params on a single request, just use unique names for them (`key` is used in the above example). | ||||
### Localization and translation | ### Localization and translation | ||||
The localization files are in the dist/lang directory. | |||||
The localization files are in the [lang](/lang) directory. Note that language files and translator is not included in SwaggerUI by default. You need to add them manually. | |||||
To enable translation you should append next two lines in your Swagger's index.html (or another entry point you use) | To enable translation you should append next two lines in your Swagger's index.html (or another entry point you use) | ||||
```html | ```html | ||||
@@ -21523,6 +21523,7 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({ | |||||
url = response.request.url; | url = response.request.url; | ||||
} | } | ||||
var headers = response.headers; | var headers = response.headers; | ||||
content = jQuery.trim(content); | |||||
// if server is nice, and sends content-type back, we can use it | // if server is nice, and sends content-type back, we can use it | ||||
var contentType = null; | var contentType = null; | ||||
@@ -0,0 +1,53 @@ | |||||
'use strict'; | |||||
/* jshint quotmark: double */ | |||||
window.SwaggerTranslator.learn({ | |||||
"Warning: Deprecated":"Warning: Deprecated", | |||||
"Implementation Notes":"Implementation Notes", | |||||
"Response Class":"Response Class", | |||||
"Status":"Status", | |||||
"Parameters":"Parameters", | |||||
"Parameter":"Parameter", | |||||
"Value":"Value", | |||||
"Description":"Description", | |||||
"Parameter Type":"Parameter Type", | |||||
"Data Type":"Data Type", | |||||
"Response Messages":"Response Messages", | |||||
"HTTP Status Code":"HTTP Status Code", | |||||
"Reason":"Reason", | |||||
"Response Model":"Response Model", | |||||
"Request URL":"Request URL", | |||||
"Response Body":"Response Body", | |||||
"Response Code":"Response Code", | |||||
"Response Headers":"Response Headers", | |||||
"Hide Response":"Hide Response", | |||||
"Try it out!":"Try it out!", | |||||
"Show/Hide":"Show/Hide", | |||||
"List Operations":"List Operations", | |||||
"Expand Operations":"Expand Operations", | |||||
"Raw":"Raw", | |||||
"can't parse JSON. Raw result":"can't parse JSON. Raw result", | |||||
"Model Schema":"Model Schema", | |||||
"Model":"Model", | |||||
"apply":"apply", | |||||
"Username":"Username", | |||||
"Password":"Password", | |||||
"Terms of service":"Terms of service", | |||||
"Created by":"Created by", | |||||
"See more at":"See more at", | |||||
"Contact the developer":"Contact the developer", | |||||
"api version":"api version", | |||||
"Response Content Type":"Response Content Type", | |||||
"fetching resource":"fetching resource", | |||||
"fetching resource list":"fetching resource list", | |||||
"Explore":"Explore", | |||||
"Show Swagger Petstore Example Apis":"Show Swagger Petstore Example Apis", | |||||
"Show Wordnik Developer Apis":"Show Wordnik Developer Apis", | |||||
"Can't read from server. It may not have the appropriate access-control-origin settings.":"Can't read from server. It may not have the appropriate access-control-origin settings.", | |||||
"Please specify the protocol for":"Please specify the protocol for", | |||||
"Can't read swagger JSON from":"Can't read swagger JSON from", | |||||
"Finished Loading Resource Information. Rendering Swagger UI":"Finished Loading Resource Information. Rendering Swagger UI", | |||||
"Unable to read api":"Unable to read api", | |||||
"from path":"from path", | |||||
"server returned":"server returned" | |||||
}); |
@@ -0,0 +1,53 @@ | |||||
'use strict'; | |||||
/* jshint quotmark: double */ | |||||
window.SwaggerTranslator.learn({ | |||||
"Warning: Deprecated":"Ворнинг: Депрекейтед", | |||||
"Implementation Notes":"Заметки", | |||||
"Response Class":"Пример ответа", | |||||
"Status":"Статус", | |||||
"Parameters":"Параметры", | |||||
"Parameter":"Параметр", | |||||
"Value":"Значение", | |||||
"Description":"Описание", | |||||
"Parameter Type":"Тип параметра", | |||||
"Data Type":"Тип данных", | |||||
"HTTP Status Code":"HTTP код", | |||||
"Reason":"Причина", | |||||
"Response Model":"Структура ответа", | |||||
"Request URL":"URL запроса", | |||||
"Response Body":"Тело ответа", | |||||
"Response Code":"HTTP код ответа", | |||||
"Response Headers":"Заголовки ответа", | |||||
"Hide Response":"Спрятать ответ", | |||||
"Response Messages":"Что может прийти в ответ", | |||||
"Try it out!":"Попробовать!", | |||||
"Show/Hide":"Показать/Скрыть", | |||||
"List Operations":"Операции кратко", | |||||
"Expand Operations":"Операции подробно", | |||||
"Raw":"В сыром виде", | |||||
"can't parse JSON. Raw result":"Не удается распарсить ответ:", | |||||
"Model Schema":"Структура", | |||||
"Model":"Описание", | |||||
"apply":"применить", | |||||
"Username":"Имя пользователя", | |||||
"Password":"Пароль", | |||||
"Terms of service":"Условия использования", | |||||
"Created by":"Разработано", | |||||
"See more at":"Еще тут", | |||||
"Contact the developer":"Связаться с разработчиком", | |||||
"api version":"Версия API", | |||||
"Response Content Type":"Content Type ответа", | |||||
"fetching resource":"Получение ресурса", | |||||
"fetching resource list":"Получение ресурсов", | |||||
"Explore":"Поехали", | |||||
"Show Swagger Petstore Example Apis":"Показать примеры АПИ", | |||||
"Show Wordnik Developer Apis":"Показать АПИ Wordnik Developer", | |||||
"Can't read from server. It may not have the appropriate access-control-origin settings.":"Не удается получить ответ от сервера. Возможно, какая-то лажа с настройками доступа", | |||||
"Please specify the protocol for":"Пожалуйста, укажите протогол для", | |||||
"Can't read swagger JSON from":"Не получается прочитать swagger json из", | |||||
"Finished Loading Resource Information. Rendering Swagger UI":"Загрузка информации о ресурсах завершена. Рендерим", | |||||
"Unable to read api":"Не удалось прочитать api", | |||||
"from path":"по адресу", | |||||
"server returned":"сервер сказал" | |||||
}); |
@@ -0,0 +1,38 @@ | |||||
'use strict'; | |||||
/** | |||||
* Translator for documentation pages. | |||||
* | |||||
* To enable translation you should include one of language-files in your index.html | |||||
* after <script src='lang/translator.js' type='text/javascript'></script>. | |||||
* For example - <script src='lang/ru.js' type='text/javascript'></script> | |||||
* | |||||
* If you wish to translate some new texsts you should do two things: | |||||
* 1. Add a new phrase pair ("New Phrase": "New Translation") into your language file (for example lang/ru.js). It will be great if you add it in other language files too. | |||||
* 2. Mark that text it templates this way <anyHtmlTag data-sw-translate>New Phrase</anyHtmlTag> or <anyHtmlTag data-sw-translate value='New Phrase'/>. | |||||
* The main thing here is attribute data-sw-translate. Only inner html, title-attribute and value-attribute are going to translate. | |||||
* | |||||
*/ | |||||
window.SwaggerTranslator = { | |||||
_words:[], | |||||
translate: function() { | |||||
var $this = this; | |||||
$('[data-sw-translate]').each(function() { | |||||
$(this).html($this._tryTranslate($(this).html())); | |||||
$(this).val($this._tryTranslate($(this).val())); | |||||
$(this).attr('title', $this._tryTranslate($(this).attr('title'))); | |||||
}); | |||||
}, | |||||
_tryTranslate: function(word) { | |||||
return this._words[word] !== undefined ? this._words[word] : word; | |||||
}, | |||||
learn: function(wordsMap) { | |||||
this._words = wordsMap; | |||||
} | |||||
}; |