Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


HTML
<!--CUSTOM CODE to add weglot translation plugin-->
       <div id="translation-desc" style="display: inline-block; margin-right: 12px; padding: 12px; border: 1px solid #eaeaea; margin-bottom: 20px;">
	        <span id='weglot_stx_message'></span>
	        <div class="weglot_here"></div>
        </div> 
        <script type="text/javascript" src="https://cdn.weglot.com/weglot.min.js"></script>
        <script>
        	var getSpaceName = function() {
        	        var spaceName = ""; 
        		var spaceKey = document.head.querySelector("[name=confluence-space-key]"); 
        		if(spaceKey){
        			spaceName = spaceKey.content;
        		}
        	        return spaceName;
        	};
        	var getPageLanguage = function() {  
        		switch(getSpaceName()) {
        			case "DOCFR":
        				return "fr";
        			case "IDOCFR":
        				return "en";
        			case "DOCEN":
        				return "en";
        			case "DOCES":
        				return "es";
        			default:
        				return "en";	
        		}
        	}; 
        	var getPageLanguageLabel = function() { 
        		switch(getPageLanguage()) {
        			case "fr":
        				return "French";
        			case "en":
        				return "English";
        			case "es":
        				return "Spanish";
        			default:
        				return "English";	
        		}
        	}; 
        	$("#weglot_stx_message").text("The source language of this article is " + getPageLanguageLabel() + ". This article can be translated automatically by selecting the desired language here: ");
        	if(getSpaceName() === "DOCFR"){
        	        	Weglot.setup({
        	        	  api_key: 'wg_50334e1cf73fca3d23ba9535226a2dde',
        	        	  originalLanguage: getPageLanguage(),
        	        	  destinationLanguages : 'en,fr,es,de',
        	        	  exceptions:'.notranslate',
        	        	  dynamic: '.ia-fixed-sidebar',
        	        	 });
        	}
        	else {
        	        	$( "#translation-desc" ).remove();
        	}
        </script>
        <!-- END CUSTOM CODE-->

Installation en utilisant le kit SecuTix

...