Google Translate Macro

Last modified by Thomas Mortagne on 2026/02/26 15:38

cogTranslates the full wiki page into a language using Google Translation
TypeXAR
Category
Developed by

Matthias Wegner

Rating
1 Votes
LicenseGNU Lesser General Public License 2.1

Table of contents

Description

Place the following macro in your page and it'll offer a select box to choose a language. When the language is selected the full page is then translated in the selected language.

{{translation/}}

For example selecting "Yiddish" will give:

googletranslate.png

Source

For reference, the Macro contains the following source code:

{{velocity}}
{{html}}
<div class="noPrint" style="float: right;" id="google_translate_element"></div>
<script type="text/javascript">
 function googleTranslateElementInit() {
   new google.translate.TranslateElement({pageLanguage: '$doc.defaultLanguage', 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>
{{/html}}
{{/velocity}}

To use the noPrint class you need the css-extension:

@media print 
{
  .noPrint
    {
     display:none;
  }
}

Get Connected