Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Google Translate Code

Go to End

3 Posts   1624 Views


Community Member, 48 Posts

27 October 2010 at 9:18am

Edited: 27/10/2010 9:22am

Hi, I'd like to use Google translate Element ->

I tried to do it 2 ways:

1) I just copy and paste whole code to template

<div id="google_translate_element"></div><script>
function googleTranslateElementInit() {
  new google.translate.TranslateElement({
    pageLanguage: 'pl'
  }, 'google_translate_element');
</script><script src="//"></script>

2) I add the <div id="google_translate_element"></div><script> to the and JS to the Page Controller

function googleTranslateElementInit() {
  new google.translate.TranslateElement({pageLanguage: "pl"}, "google_translate_element");

It works in IE 8.0 but doesn't works in FF, Chrome, Opera...
Have you got any ideas... the code works on other not SS sites :(

site is here ->

Ryan M.

Community Member, 309 Posts

27 October 2010 at 2:42pm

Edited: 27/10/2010 2:44pm

I think I see the translate stuff just fine. See attached screenshot:

Did you flush the template cache and empty your browser cache? If you haven't, empty your browser cache and do this:

By the way, tested in Mac FF and Mac Chrome.

Attached Files

Community Member, 48 Posts

30 October 2010 at 5:57am

Yes, it's OK now because I have removed the first ilne from template that generate page in XML. XML was the barrier for javascript modifaction on DOM.