Compago

...free knowledge

 
  • Increase font size
  • Default font size
  • Decrease font size
Home Manuali Utilità How to add the Google translator widget to a Joomla website

How to add the Google translator widget to a Joomla website

E-mail Stampa PDF

If you want to add language translation functionality into your Joomla website so that the website's visitors can read your pages in their native language, you can use a translator widget.
These widget are a little piece of html/javascript code and, using joomla, it's very simple to put then in a module by the compago blank module. Our aim is to try to install less extension as possible, in order to let the website framework clean and light, so using the blank module you don't need to install other plugins or components or modules.

The most famous translation widget is the Google translator widget, that you can configure as you want by the google configurator.

The options are quite simple:

Type of translation element

  1. Add translation to the entire webpage
  2. Add translation to a section of the webpage

Usually is better to translate the entire page, with menù, modules .... then I suggest to use the first option.

Default language

Here there is a list of all the laguages supported by google translator. This language will be adopted as the source language for the translation. Anyway you can choose even the option "Detect Language" in case there page's parts with different languages.

Translation Languages

This is the output languages that you let to use by the users for the translation. You can choose "All language" or a few language.

Display mode

  • Inline
    1. Vertical
    2. Horizontal
    3. Dropdown only
  • Tabbed
    1. Lower right
    2. Your webpage
    3. Translate
    4. Lower left
    5. Upper right
    6. Upper left
  • Automatic

Because we want to put the widget in a module, we must use the inline option. the automatic option is good...but I prefer to let the choice to the user.

Advanced

Automatically display the translation banner for the users speaking other languages than your page language.

Usually I prefere do not use the translation banner.

Your page contains content in more than one languages.

Here you can use this option if the souce language are moe than one.

That's it! Now you will generate the code, like this:

<div id="google_translate_element"></div><script>
function googleTranslateElementInit() {
new google.translate.TranslateElement({
pageLanguage: 'en',
autoDisplay: false
}, 'google_translate_element');
}
</script><script src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>

Now we can use a blank module to insert in our joomla website. To do it just open a new blank module configuration (or create one) and copy the text code in the first text area (HTML/Javascript), be sure that is the only text area enabled and choose the module position in your template.

After that you can save it and check you website for the result.

In this way you add a translation functionality without install any joomla extension.

Yahoo Babel Fish

If you prefere to install the Yahoo translator widget the procedure is the same and the code to put in the blank module is:

<script type="text/javascript" 
charset="UTF-8"
language="JavaScript1.2"
src="http://uk.babelfish.yahoo.com/free_trans_service/babelfish2.js?from_lang=en&region=us">
</script>

The option "from_lang" is the default language of your website.

Ultimo aggiornamento ( Domenica 11 Marzo 2012 14:21 )  
Loading

Login




Chiudi