Jump to content

[Solved] Google Translate Button On Site


Recommended Posts

Hello,

 

I want to add some code to a Prestashop site, for a google translate button.

Does anyone knows how i can add this code to the homepage?

Just add the code above a page with the <> code on doesn't work.

 

 

This is the code;

 

 <div id="google_translate_element"></div><script type="text/javascript">

function googleTranslateElementInit() {

  new google.translate.TranslateElement({pageLanguage: 'nl'}, 'google_translate_element');

}

</script><script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>

 
Edited by pdaalmeer (see edit history)
Link to comment
Share on other sites

thanks for the answer. Still something goes wrong, but i'm new with Prestashop. When i add the code in the CMS page i get an error "The field content is invalid."

 

i add this in the editor CMS page   ( using the source code </>)

<div id="google_translate_element"></div>

<script>// <![CDATA[
{literal}
function googleTranslateElementInit() {
  new google.translate.TranslateElement({pageLanguage: 'nl'}, 'google_translate_element');
}
{/literal}
// ]]></script>
<script src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...