Google Translate

We have a few sites at work that has Google Translate at the top of the site which enables people to view the site in different languages. Of course, we also have a disclaimer that the translation may or may not be accurate. Is there a way for me to add the following lines of of Javascript easily in Plone to enable the following:

Basically, it is possible to add the following scripts to Plone? If so how and where can I do so?

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

<script type="text/javascript">
function googleTranslateElementInit() {
  new google.translate.TranslateElement({pageLanguage: 'en'}, 'google_translate_element');

<script type="text/javascript" src="//"></script>

Any advice would be most appreciated. Thank you so much.

I hack the to do this kind of stuff.

Although easy, it's really not the right answer.

The "Right" way is to add it to your resource registry - even Through The Web:

I would do

  1. If it is a diazo theme: add it to index.html (or whatever file defined in rules.xml


  1. Add a viewlet

I dont think editing main_template is a good idea (it might give you problems later in life )

It does if you're not careful. I don't recommend it either.

I think the header viewlet is the way to go.