Google or Bing Translate website widget

Nicky


Ruud

Use an extra section of the type "Code". This allows you to use php code.
In that section you can use the "echo" command to output the code like this:
(note the escaped single quotes in the javascript call!)

echo '
<div id="google_translate_element"></div>
<script type="text/javascript">
  function googleTranslateElementInit() {
    new google.translate.TranslateElement({pageLanguage: \'en\', layout: google.translate.TranslateElement.InlineLayout.SIMPLE, autoDisplay: false, multilanguagePage: true}, \'google_translate_element\');
  }
</script>
<script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
';
[url=https://dev4me.com/modules-snippets/]Dev4me - WebsiteBaker modules[/url] - [url=https://wbhelp.org/]WBhelp.org[/url]

Nicky

Hello Bakers!

Google or Bing Translate website widget ...

If I embed their javascript in my wb template, they load ok ( either of them ).
But I want to add their javascript to specific wb pages but I cannot get those script(s) to load !
Nothing appears, nor any errors.

Here's the Google's javascript ...

<div id="google_translate_element"></div><script type="text/javascript">
function googleTranslateElementInit() {
  new google.translate.TranslateElement({pageLanguage: 'en', layout: google.translate.TranslateElement.InlineLayout.SIMPLE, autoDisplay: false, multilanguagePage: true}, 'google_translate_element');
}
</script><script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>       

After many days trying different things, what do I need to do to fix this please? 

WB-Version 2.10.0

Regards,
N

ps.  I've got a weather widget javascript on my home page and that works fine in a wb section !?  (Y)