Showing posts with label google translate. Show all posts
Showing posts with label google translate. Show all posts

Thursday, 25 September 2014

Google Translator plugin for Browsers in Js

<script type="text/javascript">function googleTranslateElementInit() {
  var elem = new google.translate.TranslateElement({
    pageLanguage: "ca", 
    layout: google.translate.TranslateElement.InlineLayout.HORIZONTAL,
    autoDisplay: false,
    floatPosition: 0
  });
  elem.onTurnOffLanguageClick = function() {
    var event = document.createEvent("Event");
    event.initEvent("translateExt_disable_lang", true, true);
    document.body.dispatchEvent(event);
  };
  var style = document.createElement("style");
  style.appendChild( document.createTextNode( ".global_header { top: 40px !important; }" ) );
  document.getElementsByTagName( "head" )[ 0 ].appendChild( style );
  elem.showBanner(false);
}</script>