diff options
author | vvarvate <vv00489503@techmahindra.com> | 2018-03-23 19:25:55 +0530 |
---|---|---|
committer | vvarvate <vv00489503@techmahindra.com> | 2018-03-23 19:27:59 +0530 |
commit | 543004a668263b6d669ffd338b99154d7f91f6a0 (patch) | |
tree | 139c817f68a1d6938e9494c066b108eccc81fc99 /sdnc_report_api_sdnc_253_story/sdnc_reports_service/src/main/resources/static/lang/translator.js | |
parent | 8a4ef574e32c8f42706a863868485a070d85f446 (diff) |
SDNC-254 Historical Report Swagger API
sdnc_reports_service Provides REST API for viewing historical reports remotely .
Issue-ID: SDNC-254
Change-Id: Ifd1213fcd26d7fd2400a32e1a40649b54059f737
Signed-off-by: vvarvate <vv00489503@techmahindra.com>
Diffstat (limited to 'sdnc_report_api_sdnc_253_story/sdnc_reports_service/src/main/resources/static/lang/translator.js')
-rw-r--r-- | sdnc_report_api_sdnc_253_story/sdnc_reports_service/src/main/resources/static/lang/translator.js | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_service/src/main/resources/static/lang/translator.js b/sdnc_report_api_sdnc_253_story/sdnc_reports_service/src/main/resources/static/lang/translator.js new file mode 100644 index 0000000..591f6d4 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_service/src/main/resources/static/lang/translator.js @@ -0,0 +1,39 @@ +'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(sel) { + var $this = this; + sel = sel || '[data-sw-translate]'; + + $(sel).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[$.trim(word)] !== undefined ? this._words[$.trim(word)] : word; + }, + + learn: function(wordsMap) { + this._words = wordsMap; + } +}; |