summaryrefslogtreecommitdiffstats
path: root/services/activity-spec/swagger-ui/lang/translator.js
diff options
context:
space:
mode:
authorsheetalm <sheetal.mudholkar@amdocs.com>2018-02-20 19:06:27 +0530
committerVitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com>2018-03-08 08:50:18 +0000
commit297209b45b403e9b314ebeb1140886e00ffd3f6d (patch)
treea8ba88380016fed0d1f28fbddfc4d4909ca22165 /services/activity-spec/swagger-ui/lang/translator.js
parent2b60bd08c6b209c0817fac84970c35df4abca6ed (diff)
Activity Spec Service - Implementation
Correcting error message. InternalEmptyObject not required to be serializable. Fixed review comments on Patch Set 10. Not all fixed Adding services profile in main sdc pom.Moving Static imports at end. Patch Set 7 changes Patch Set 6 - Removing javax.inject. Remove user from interface and Changing scope to be singleton. Correcting error message Patch Set 4 Not fixing Spring related review comments in this patch set Patch Set 4 Fixed review comments related to unused dependency Fixed review comments for plugin version. Corrected License Adding Activity Spec Service Implementation Not adding to main sdc pom as of now Change-Id: I5285c0ab3b71b492d18ca442ebd52b59ab0eabdc Issue-ID: SDC-1048 Signed-off-by: sheetalm <sheetal.mudholkar@amdocs.com>
Diffstat (limited to 'services/activity-spec/swagger-ui/lang/translator.js')
-rw-r--r--services/activity-spec/swagger-ui/lang/translator.js39
1 files changed, 39 insertions, 0 deletions
diff --git a/services/activity-spec/swagger-ui/lang/translator.js b/services/activity-spec/swagger-ui/lang/translator.js
new file mode 100644
index 0000000000..591f6d4094
--- /dev/null
+++ b/services/activity-spec/swagger-ui/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;
+ }
+};