Was this page helpful?

Embed a language translater in a page

    Table of contents
    No headers

    To create a simple template that will translate your page to any language using Google Translate:

    1. Create a page named Template:Translate
    2. Toggle to HTML Source and insert the following:
      <div style="float: right;">
        <script src="{{'http://www.gmodules.com/ig/ifr?url=http://www.google.com/ig/modules/translatemypage.xml&up_source_language=' .. string.split(page.language !== '' ? page.language : site.language, '-', 2)[0] .. '&w=160&h=60&title=&border=&output=js'}}">
        </script>
      </div>
    3. Save the template.
    4. Insert the following code on the page in which you wish the Google Translate control box to appear (the control box will automatically align right per the template):
    5. {{ wiki.template("Translate") }}
    6. Demo: 
    Was this page helpful?
    Tag page
    Viewing 1 of 1 comments: view all
    I think Google has changes their translation tool. So, the above code doesn't work. Or, at least it didn't work in my instance. When I pulled this code from the Google tranlator site, it worked:

    <div id="google_translate_element">&nbsp;</div>
    <script>/*<![CDATA[*/
    function googleTranslateElementInit() {
    new google.translate.TranslateElement({
    pageLanguage: 'en'
    }, 'google_translate_element');
    }
    /*]]>*/</script><script src="http://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
    Posted 07:47, 3 Jun 2010
    Viewing 1 of 1 comments: view all
    You must login to post a comment.

    Copyright © 2011 MindTouch, Inc. Powered by