cerovic Posted December 19, 2013 Share Posted December 19, 2013 Hello. I wanted to insert Google Website Translator Gadget to the header.tpl to use google translator in my PS. The code works for static pages (see www.umarosa.sk - my friend web) but when I insert this code to directly to theme header.tpl, the ERROR occurred and there s just blank page, so it completely brake the page. Code: <DIV id=google_translate_element></DIV> <SCRIPT type=text/javascript> function googleTranslateElementInit() { new google.translate.TranslateElement({pageLanguage: 'sk', includedLanguages: 'de,en,hu,pl,ru', layout: google.translate.TranslateElement.InlineLayout.SIMPLE}, 'google_translate_element'); } </SCRIPT> <SCRIPT type=text/javascript src="ub_files/element.js"></SCRIPT> </DIV> You can generate your own google code on: https://translate.google.com/manager/website/ . So I tired to Bing translator and same result - just blank page. Code: <div id='MicrosoftTranslatorWidget' class='Dark' style='color:white;background-color:#555555'></div><script type='text/javascript'>setTimeout(function()[spam-filter]var s=document.createElement('script');s.type='text/javascript';s.charset='UTF-8';s.src=((location && location.href && location.href.indexOf('https') == 0)?'https://ssl.microsofttranslator.com':'http://www.microsofttranslator.com')+'/ajax/v3/WidgetV3.ashx?siteData=ueOIGRSKkd965FeEGM5JtQ**&ctf=True&ui=true&settings=Manual&from=sk';var p=document.getElementsByTagName('head')[0]||document.documentElement;p.insertBefore(s,p.firstChild); [spam-filter],0);</script> Code from: http://www.bing.com/widget/translator . Also this code works for static pages, just cooperation with PS scripts makes the site broken - just blank site without any content. Is it possible to implement google, or bing translator directly to theme in this way? Link to comment Share on other sites More sharing options...
JDB Allyx Posted January 6, 2014 Share Posted January 6, 2014 Hello,I used the "Belvg Blocks Constructor " module, to add this google translation widget in my shop (and many others, this module is fine). This code (generated by Google) is in 2 parts :- 1 part to put before "/head " (and I don't know in which file) ?- 1 part to put where you want the text appears (for this part, I used Belvg Module)The widget works, but I can't used Google analytics tracking, I suppose because I don't put the first part of the code...Does someone have a solution ? Accessoires pour mariage et ceremonie Link to comment Share on other sites More sharing options...
mirra99 Posted February 13, 2014 Share Posted February 13, 2014 I actually have the same problem. It seems like this part of the snippet collides with PS scripts somehow. Hope somebody has a solution, as it seems it should be pretty easy to fix for an experienced programmer. <script type="text/javascript">function googleTranslateElementInit() { new google.translate.TranslateElement({pageLanguage: 'cs', layout: google.translate.TranslateElement.InlineLayout.SIMPLE}, 'google_translate_element'); } </script> Link to comment Share on other sites More sharing options...
vishnuo Posted April 2, 2014 Share Posted April 2, 2014 (edited) I found this is an another thread and seemed to work: <div id="google_translate_element"></div><script>function googleTranslateElementInit() {new google.translate.TranslateElement({pageLanguage: 'en',layout: google.translate.TranslateElement.InlineLayout.SIMPLE}, 'google_translate_element');}</script><script src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script> Edited April 2, 2014 by vishnuo (see edit history) 1 Link to comment Share on other sites More sharing options...
Anaa Posted September 24, 2015 Share Posted September 24, 2015 (edited) Dear All PS user, I would like to share ,how to use Google translate gadget on Prestashop very easy way. This is mgiht be help, First :download HTML box module free from here ...https://mypresta.eu/modules/front-office-features/html-box.html & intsall it. Second: Go to https://translate.google.com/manager/website/ and sign in to your Google account when you are prompted to.,,,,,& follow the steps than get a code from there.. Third : The paste the goodle translate code on HTML box and select the HEADER option. Test your machine translation .......:-) This way works for me ...try it ... have a good day! Anaa Edited September 24, 2015 by Anaa (see edit history) 1 Link to comment Share on other sites More sharing options...
sboule Posted October 4, 2015 Share Posted October 4, 2015 Hi, I did your solution Anaa but unfortunatly it doesn t work yet I put this : <div id="google_translate_element"></div><script type="text/javascript"> function googleTranslateElementInit() { new google.translate.TranslateElement({pageLanguage: 'fr', layout: google.translate.TranslateElement.InlineLayout.SIMPLE, autoDisplay: false}, 'google_translate_element'); } </script><script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script> And the result : If you can help me Thanks 1 Link to comment Share on other sites More sharing options...
Anaa Posted October 4, 2015 Share Posted October 4, 2015 Hi Sboule Seems it's working very well on your website...I use G-translate to Chinese... very well working See attachment image...French and many more languages there.... Remember clear cache all the time whenever you do changes...ctrl+F5 .....after that you see the result of your changes.....:-) Have a good day Regards Anaa . Link to comment Share on other sites More sharing options...
sboule Posted October 6, 2015 Share Posted October 6, 2015 (edited) hi, For prestashop 1.6.1 i diid that to get it : disabling the "html purifier" option that is available under preferences > general section in your shop Edited October 6, 2015 by sboule (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now