Skip to content

Commit 8e72906

Browse files
committed
Merge pull request #1487 from swagger-api/develop_2.0
Prepare for release
2 parents 139841f + c7c6972 commit 8e72906

36 files changed

+2395
-1932
lines changed

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
## Pull Requests
2-
Plase make your pull requests are made to the [**`develop_2.0`**](https://github.com/swagger-api/swagger-ui/tree/develop_2.0) branch at this time.
2+
Please open your pull requests against the [**`develop_2.0`**](https://github.com/swagger-api/swagger-ui/tree/develop_2.0) branch at this time.
33

44
## Issues
55
SwaggerUI uses [SwaggerJS](https://github.com/swagger-api/swagger-js) library for many internal operations. If you see errors in

bower.json

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"name": "swagger-ui",
33
"main": "dist/index.html",
4-
"version": "2.1.0",
54
"authors": [
65
"Mohsen Azimi <[email protected]>"
76
],

dist/css/screen.css

+18-12
Original file line numberDiff line numberDiff line change
@@ -1155,8 +1155,16 @@
11551155
.swagger-section .auth {
11561156
float: right;
11571157
}
1158-
.swagger-section #api_information_panel {
1159-
position: absolute;
1158+
.swagger-section .api-ic {
1159+
height: 18px;
1160+
vertical-align: middle;
1161+
display: inline-block;
1162+
background: url(../images/explorer_icons.png) no-repeat;
1163+
}
1164+
.swagger-section .api-ic .api_information_panel {
1165+
position: relative;
1166+
margin-top: 20px;
1167+
margin-left: -5px;
11601168
background: #FFF;
11611169
border: 1px solid #ccc;
11621170
border-radius: 5px;
@@ -1167,34 +1175,32 @@
11671175
color: black;
11681176
padding: 5px;
11691177
}
1170-
.swagger-section #api_information_panel p .api-msg-enabled {
1178+
.swagger-section .api-ic .api_information_panel p .api-msg-enabled {
11711179
color: green;
11721180
}
1173-
.swagger-section #api_information_panel p .api-msg-disabled {
1181+
.swagger-section .api-ic .api_information_panel p .api-msg-disabled {
11741182
color: red;
11751183
}
1176-
.swagger-section .api-ic {
1177-
height: 18px;
1178-
vertical-align: middle;
1179-
display: inline-block;
1180-
background: url(../images/explorer_icons.png) no-repeat;
1184+
.swagger-section .api-ic:hover .api_information_panel {
1185+
position: absolute;
1186+
display: block;
11811187
}
11821188
.swagger-section .ic-info {
11831189
background-position: 0 0;
11841190
width: 18px;
1185-
margin-top: -7px;
1191+
margin-top: -6px;
11861192
margin-left: 4px;
11871193
}
11881194
.swagger-section .ic-warning {
11891195
background-position: -60px 0;
11901196
width: 18px;
1191-
margin-top: -7px;
1197+
margin-top: -6px;
11921198
margin-left: 4px;
11931199
}
11941200
.swagger-section .ic-error {
11951201
background-position: -30px 0;
11961202
width: 18px;
1197-
margin-top: -7px;
1203+
margin-top: -6px;
11981204
margin-left: 4px;
11991205
}
12001206
.swagger-section .ic-off {

dist/index.html

+20-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<!DOCTYPE html>
22
<html>
33
<head>
4+
<meta charset="UTF-8">
45
<title>Swagger UI</title>
56
<link rel="icon" type="image/png" href="images/favicon-32x32.png" sizes="32x32" />
67
<link rel="icon" type="image/png" href="images/favicon-16x16.png" sizes="16x16" />
@@ -21,6 +22,11 @@
2122
<script src='lib/marked.js' type='text/javascript'></script>
2223
<script src='lib/swagger-oauth.js' type='text/javascript'></script>
2324

25+
<!-- Some basic translations -->
26+
<!-- <script src='lang/translator.js' type='text/javascript'></script> -->
27+
<!-- <script src='lang/ru.js' type='text/javascript'></script> -->
28+
<!-- <script src='lang/en.js' type='text/javascript'></script> -->
29+
2430
<script type="text/javascript">
2531
$(function () {
2632
var url = window.location.search.match(/url=([^&]+)/);
@@ -29,6 +35,11 @@
2935
} else {
3036
url = "http://petstore.swagger.io/v2/swagger.json";
3137
}
38+
39+
// Pre load translate...
40+
if(window.SwaggerTranslator) {
41+
window.SwaggerTranslator.translate();
42+
}
3243
window.swaggerUi = new SwaggerUi({
3344
url: url,
3445
dom_id: "swagger-ui-container",
@@ -37,11 +48,17 @@
3748
if(typeof initOAuth == "function") {
3849
initOAuth({
3950
clientId: "your-client-id",
51+
clientSecret: "your-client-secret",
4052
realm: "your-realms",
41-
appName: "your-app-name"
53+
appName: "your-app-name",
54+
scopeSeparator: ","
4255
});
4356
}
4457

58+
if(window.SwaggerTranslator) {
59+
window.SwaggerTranslator.translate();
60+
}
61+
4562
$('pre code').each(function(i, e) {
4663
hljs.highlightBlock(e)
4764
});
@@ -91,12 +108,12 @@
91108
<form id='api_selector'>
92109
<div class='input'><input placeholder="http://example.com/api" id="input_baseUrl" name="baseUrl" type="text"/></div>
93110
<div class='input'><input placeholder="api_key" id="input_apiKey" name="apiKey" type="text"/></div>
94-
<div class='input'><a id="explore" href="#">Explore</a></div>
111+
<div class='input'><a id="explore" href="#" data-sw-translate>Explore</a></div>
95112
</form>
96113
</div>
97114
</div>
98115

99-
<div id="message-bar" class="swagger-ui-wrap">&nbsp;</div>
116+
<div id="message-bar" class="swagger-ui-wrap" data-sw-translate>&nbsp;</div>
100117
<div id="swagger-ui-container" class="swagger-ui-wrap"></div>
101118
</body>
102119
</html>

dist/lang/en.js

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
'use strict';
2+
3+
/* jshint quotmark: double */
4+
window.SwaggerTranslator.learn({
5+
"Warning: Deprecated":"Warning: Deprecated",
6+
"Implementation Notes":"Implementation Notes",
7+
"Response Class":"Response Class",
8+
"Status":"Status",
9+
"Parameters":"Parameters",
10+
"Parameter":"Parameter",
11+
"Value":"Value",
12+
"Description":"Description",
13+
"Parameter Type":"Parameter Type",
14+
"Data Type":"Data Type",
15+
"Response Messages":"Response Messages",
16+
"HTTP Status Code":"HTTP Status Code",
17+
"Reason":"Reason",
18+
"Response Model":"Response Model",
19+
"Request URL":"Request URL",
20+
"Response Body":"Response Body",
21+
"Response Code":"Response Code",
22+
"Response Headers":"Response Headers",
23+
"Hide Response":"Hide Response",
24+
"Headers":"Headers",
25+
"Try it out!":"Try it out!",
26+
"Show/Hide":"Show/Hide",
27+
"List Operations":"List Operations",
28+
"Expand Operations":"Expand Operations",
29+
"Raw":"Raw",
30+
"can't parse JSON. Raw result":"can't parse JSON. Raw result",
31+
"Model Schema":"Model Schema",
32+
"Model":"Model",
33+
"apply":"apply",
34+
"Username":"Username",
35+
"Password":"Password",
36+
"Terms of service":"Terms of service",
37+
"Created by":"Created by",
38+
"See more at":"See more at",
39+
"Contact the developer":"Contact the developer",
40+
"api version":"api version",
41+
"Response Content Type":"Response Content Type",
42+
"fetching resource":"fetching resource",
43+
"fetching resource list":"fetching resource list",
44+
"Explore":"Explore",
45+
"Show Swagger Petstore Example Apis":"Show Swagger Petstore Example Apis",
46+
"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.",
47+
"Please specify the protocol for":"Please specify the protocol for",
48+
"Can't read swagger JSON from":"Can't read swagger JSON from",
49+
"Finished Loading Resource Information. Rendering Swagger UI":"Finished Loading Resource Information. Rendering Swagger UI",
50+
"Unable to read api":"Unable to read api",
51+
"from path":"from path",
52+
"server returned":"server returned"
53+
});

dist/lang/es.js

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
'use strict';
2+
3+
/* jshint quotmark: double */
4+
window.SwaggerTranslator.learn({
5+
"Warning: Deprecated":"Advertencia: Obsoleto",
6+
"Implementation Notes":"Notas de implementación",
7+
"Response Class":"Clase de la Respuesta",
8+
"Status":"Status",
9+
"Parameters":"Parámetros",
10+
"Parameter":"Parámetro",
11+
"Value":"Valor",
12+
"Description":"Descripción",
13+
"Parameter Type":"Tipo del Parámetro",
14+
"Data Type":"Tipo del Dato",
15+
"Response Messages":"Mensajes de la Respuesta",
16+
"HTTP Status Code":"Código de Status HTTP",
17+
"Reason":"Razón",
18+
"Response Model":"Modelo de la Respuesta",
19+
"Request URL":"URL de la Solicitud",
20+
"Response Body":"Cuerpo de la Respuesta",
21+
"Response Code":"Código de la Respuesta",
22+
"Response Headers":"Encabezados de la Respuesta",
23+
"Hide Response":"Ocultar Respuesta",
24+
"Try it out!":"Pruébalo!",
25+
"Show/Hide":"Mostrar/Ocultar",
26+
"List Operations":"Listar Operaciones",
27+
"Expand Operations":"Expandir Operaciones",
28+
"Raw":"Crudo",
29+
"can't parse JSON. Raw result":"no puede parsear el JSON. Resultado crudo",
30+
"Model Schema":"Esquema del Modelo",
31+
"Model":"Modelo",
32+
"apply":"aplicar",
33+
"Username":"Nombre de usuario",
34+
"Password":"Contraseña",
35+
"Terms of service":"Términos de Servicio",
36+
"Created by":"Creado por",
37+
"See more at":"Ver más en",
38+
"Contact the developer":"Contactar al desarrollador",
39+
"api version":"versión de la api",
40+
"Response Content Type":"Tipo de Contenido (Content Type) de la Respuesta",
41+
"fetching resource":"buscando recurso",
42+
"fetching resource list":"buscando lista del recurso",
43+
"Explore":"Explorar",
44+
"Show Swagger Petstore Example Apis":"Mostrar Api Ejemplo de Swagger Petstore",
45+
"Can't read from server. It may not have the appropriate access-control-origin settings.":"No se puede leer del servidor. Tal vez no tiene la configuración de control de acceso de origen (access-control-origin) apropiado.",
46+
"Please specify the protocol for":"Por favor, especificar el protocola para",
47+
"Can't read swagger JSON from":"No se puede leer el JSON de swagger desde",
48+
"Finished Loading Resource Information. Rendering Swagger UI":"Finalizada la carga del recurso de Información. Mostrando Swagger UI",
49+
"Unable to read api":"No se puede leer la api",
50+
"from path":"desde ruta",
51+
"server returned":"el servidor retornó"
52+
});

dist/lang/pt.js

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
'use strict';
2+
3+
/* jshint quotmark: double */
4+
window.SwaggerTranslator.learn({
5+
"Warning: Deprecated":"Aviso: Depreciado",
6+
"Implementation Notes":"Notas de Implementação",
7+
"Response Class":"Classe de resposta",
8+
"Status":"Status",
9+
"Parameters":"Parâmetros",
10+
"Parameter":"Parâmetro",
11+
"Value":"Valor",
12+
"Description":"Descrição",
13+
"Parameter Type":"Tipo de parâmetro",
14+
"Data Type":"Tipo de dados",
15+
"Response Messages":"Mensagens de resposta",
16+
"HTTP Status Code":"Código de status HTTP",
17+
"Reason":"Razão",
18+
"Response Model":"Modelo resposta",
19+
"Request URL":"URL requisição",
20+
"Response Body":"Corpo da resposta",
21+
"Response Code":"Código da resposta",
22+
"Response Headers":"Cabeçalho da resposta",
23+
"Headers":"Cabeçalhos",
24+
"Hide Response":"Esconder resposta",
25+
"Try it out!":"Tente agora!",
26+
"Show/Hide":"Mostrar/Esconder",
27+
"List Operations":"Listar operações",
28+
"Expand Operations":"Expandir operações",
29+
"Raw":"Cru",
30+
"can't parse JSON. Raw result":"Falha ao analisar JSON. Resulto cru",
31+
"Model Schema":"Modelo esquema",
32+
"Model":"Modelo",
33+
"apply":"Aplicar",
34+
"Username":"Usuário",
35+
"Password":"Senha",
36+
"Terms of service":"Termos do serviço",
37+
"Created by":"Criado por",
38+
"See more at":"Veja mais em",
39+
"Contact the developer":"Contate o desenvolvedor",
40+
"api version":"Versão api",
41+
"Response Content Type":"Tipo de conteúdo da resposta",
42+
"fetching resource":"busca recurso",
43+
"fetching resource list":"buscando lista de recursos",
44+
"Explore":"Explorar",
45+
"Show Swagger Petstore Example Apis":"Show Swagger Petstore Example Apis",
46+
"Can't read from server. It may not have the appropriate access-control-origin settings.":"Não é possível ler do servidor. Pode não ter as apropriadas configurações access-control-origin",
47+
"Please specify the protocol for":"Por favor especifique o protocolo",
48+
"Can't read swagger JSON from":"Não é possível ler o JSON Swagger de",
49+
"Finished Loading Resource Information. Rendering Swagger UI":"Carregar informação de recurso finalizada. Renderizando Swagger UI",
50+
"Unable to read api":"Não foi possível ler api",
51+
"from path":"do caminho",
52+
"server returned":"servidor retornou"
53+
});

dist/lang/ru.js

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
'use strict';
2+
3+
/* jshint quotmark: double */
4+
window.SwaggerTranslator.learn({
5+
"Warning: Deprecated":"Ворнинг: Депрекейтед",
6+
"Implementation Notes":"Заметки",
7+
"Response Class":"Пример ответа",
8+
"Status":"Статус",
9+
"Parameters":"Параметры",
10+
"Parameter":"Параметр",
11+
"Value":"Значение",
12+
"Description":"Описание",
13+
"Parameter Type":"Тип параметра",
14+
"Data Type":"Тип данных",
15+
"HTTP Status Code":"HTTP код",
16+
"Reason":"Причина",
17+
"Response Model":"Структура ответа",
18+
"Request URL":"URL запроса",
19+
"Response Body":"Тело ответа",
20+
"Response Code":"HTTP код ответа",
21+
"Response Headers":"Заголовки ответа",
22+
"Hide Response":"Спрятать ответ",
23+
"Response Messages":"Что может прийти в ответ",
24+
"Try it out!":"Попробовать!",
25+
"Show/Hide":"Показать/Скрыть",
26+
"List Operations":"Операции кратко",
27+
"Expand Operations":"Операции подробно",
28+
"Raw":"В сыром виде",
29+
"can't parse JSON. Raw result":"Не удается распарсить ответ:",
30+
"Model Schema":"Структура",
31+
"Model":"Описание",
32+
"apply":"применить",
33+
"Username":"Имя пользователя",
34+
"Password":"Пароль",
35+
"Terms of service":"Условия использования",
36+
"Created by":"Разработано",
37+
"See more at":"Еще тут",
38+
"Contact the developer":"Связаться с разработчиком",
39+
"api version":"Версия API",
40+
"Response Content Type":"Content Type ответа",
41+
"fetching resource":"Получение ресурса",
42+
"fetching resource list":"Получение ресурсов",
43+
"Explore":"Поехали",
44+
"Show Swagger Petstore Example Apis":"Показать примеры АПИ",
45+
"Can't read from server. It may not have the appropriate access-control-origin settings.":"Не удается получить ответ от сервера. Возможно, какая-то лажа с настройками доступа",
46+
"Please specify the protocol for":"Пожалуйста, укажите протогол для",
47+
"Can't read swagger JSON from":"Не получается прочитать swagger json из",
48+
"Finished Loading Resource Information. Rendering Swagger UI":"Загрузка информации о ресурсах завершена. Рендерим",
49+
"Unable to read api":"Не удалось прочитать api",
50+
"from path":"по адресу",
51+
"server returned":"сервер сказал"
52+
});

dist/lang/translator.js

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
'use strict';
2+
3+
/**
4+
* Translator for documentation pages.
5+
*
6+
* To enable translation you should include one of language-files in your index.html
7+
* after <script src='lang/translator.js' type='text/javascript'></script>.
8+
* For example - <script src='lang/ru.js' type='text/javascript'></script>
9+
*
10+
* If you wish to translate some new texsts you should do two things:
11+
* 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.
12+
* 2. Mark that text it templates this way <anyHtmlTag data-sw-translate>New Phrase</anyHtmlTag> or <anyHtmlTag data-sw-translate value='New Phrase'/>.
13+
* The main thing here is attribute data-sw-translate. Only inner html, title-attribute and value-attribute are going to translate.
14+
*
15+
*/
16+
window.SwaggerTranslator = {
17+
18+
_words:[],
19+
20+
translate: function(sel) {
21+
var $this = this;
22+
sel = sel || '[data-sw-translate]';
23+
24+
$(sel).each(function() {
25+
$(this).html($this._tryTranslate($(this).html()));
26+
27+
$(this).val($this._tryTranslate($(this).val()));
28+
$(this).attr('title', $this._tryTranslate($(this).attr('title')));
29+
});
30+
},
31+
32+
_tryTranslate: function(word) {
33+
return this._words[$.trim(word)] !== undefined ? this._words[$.trim(word)] : word;
34+
},
35+
36+
learn: function(wordsMap) {
37+
this._words = wordsMap;
38+
}
39+
};

0 commit comments

Comments
 (0)