diff --git a/README.md b/README.md index 67e6b88f..61f24445 100644 --- a/README.md +++ b/README.md @@ -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). ### 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) ```html diff --git a/dist/css/print.css b/dist/css/print.css index b4fc1803..a48f0585 100644 --- a/dist/css/print.css +++ b/dist/css/print.css @@ -274,6 +274,9 @@ font-weight: bold; font-size: 25px; } +.swagger-section .swagger-ui-wrap .footer { + margin-top: 20px; +} .swagger-section .swagger-ui-wrap p.big, .swagger-section .swagger-ui-wrap div.big p { font-size: 1em; diff --git a/dist/css/screen.css b/dist/css/screen.css index 32b199b1..ca381b9e 100644 --- a/dist/css/screen.css +++ b/dist/css/screen.css @@ -274,6 +274,9 @@ font-weight: bold; font-size: 25px; } +.swagger-section .swagger-ui-wrap .footer { + margin-top: 20px; +} .swagger-section .swagger-ui-wrap p.big, .swagger-section .swagger-ui-wrap div.big p { font-size: 1em; diff --git a/dist/index.html b/dist/index.html index 19b17b8b..5194dbc2 100644 --- a/dist/index.html +++ b/dist/index.html @@ -19,6 +19,7 @@ + . + * For example - + * + * 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 New Phrase or . + * 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; + } +}; diff --git a/lib/swagger-oauth.js b/lib/swagger-oauth.js index 3b69fd3d..fed588c6 100644 --- a/lib/swagger-oauth.js +++ b/lib/swagger-oauth.js @@ -281,4 +281,4 @@ window.onOAuthComplete = function onOAuthComplete(token) { } } } -} \ No newline at end of file +} diff --git a/package.json b/package.json index 3886d7d8..4bd2a204 100644 --- a/package.json +++ b/package.json @@ -1,14 +1,17 @@ { "name": "swagger-ui", "author": "Tony Tam ", - "contributors": [{ - "name": "Mohsen Azimi", - "email": "me@azimi.me" - }], + "contributors": [ + { + "name": "Mohsen Azimi", + "email": "me@azimi.me" + } + ], "description": "Swagger UI is a dependency-free collection of HTML, JavaScript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API", - "version": "2.1.1-M2", + "version": "2.1.2-M2", "homepage": "http://swagger.io", "license": "Apache 2.0", + "main": "dist/swagger-ui.js", "scripts": { "build": "gulp", "serve": "gulp serve", @@ -35,6 +38,7 @@ "gulp-declare": "^0.3.0", "gulp-handlebars": "^3.0.1", "gulp-header": "^1.2.2", + "gulp-jshint": "^1.10.0", "gulp-less": "^3.0.1", "gulp-order": "^1.1.1", "gulp-rename": "^1.2.0", @@ -42,9 +46,10 @@ "gulp-watch": "^4.1.1", "gulp-wrap": "^0.11.0", "http-server": "git+https://github.com/nodeapps/http-server.git", + "jshint-stylish": "^1.0.1", "less": "^2.4.0", "mocha": "^2.1.0", "selenium-webdriver": "^2.45.0", - "swagger-client": "2.1.2-M2" + "swagger-client": "2.1.4-M2" } } diff --git a/src/main/html/css/print.css b/src/main/html/css/print.css index b4fc1803..a48f0585 100644 --- a/src/main/html/css/print.css +++ b/src/main/html/css/print.css @@ -274,6 +274,9 @@ font-weight: bold; font-size: 25px; } +.swagger-section .swagger-ui-wrap .footer { + margin-top: 20px; +} .swagger-section .swagger-ui-wrap p.big, .swagger-section .swagger-ui-wrap div.big p { font-size: 1em; diff --git a/src/main/html/css/screen.css b/src/main/html/css/screen.css index 32b199b1..ca381b9e 100644 --- a/src/main/html/css/screen.css +++ b/src/main/html/css/screen.css @@ -274,6 +274,9 @@ font-weight: bold; font-size: 25px; } +.swagger-section .swagger-ui-wrap .footer { + margin-top: 20px; +} .swagger-section .swagger-ui-wrap p.big, .swagger-section .swagger-ui-wrap div.big p { font-size: 1em; diff --git a/src/main/html/index.html b/src/main/html/index.html index 19b17b8b..5194dbc2 100644 --- a/src/main/html/index.html +++ b/src/main/html/index.html @@ -19,6 +19,7 @@ +