Installing Google Translator Widget With Flags


IDFR CNJP SAIN NLESVN
Want to reach wider international audience? What better way to do it than by allowing your readers to read your articles in his or her own language!
Installing a translator on your webpage or blog will do just that. Google translator can translate your web page into 56 languages (as of 24 August 2009).
In this tutorial I will show you how to add a Google translator widget with the corresponding nation’s flag icons.
Without further ado,


  1. Go to Dashboard > Design > Page Elements.
  2. Click Add A Gadget.
  3. In Add A Gadget window, select HTML/Javascript.
  4. Enter the title of your widget e.g. Translate This Page. This is optional.
  5. Copy the code below and paste it inside the window.
  6. Click Save.
1<!-- Translate flag BEGIN -->
2<!-- by www.bloggersentral.com -->
3<a class="translate-flag"
4onclick="href='http://translate.google.com/translate?u='+encodeURIComponent(location.href)+'&amp;langpair=SourceLangCode|TargetLangCode&amp;hl=InterfaceLangCode'"title="Translate to TargetLangName" target="_blank"><img border="0" style="cursor: pointer;"src="FlagIconURL" /></a>
5<!-- Translate flag END -->
Where:
  • SourceLangCode is the code web page original language,TargetLangCode is the code for language you want the page translated into, and InterfaceLangCode is code for Google translator bar language.
  • TargetLangName is the name of targeted language.
  • Replace all those variables with their respective Google language codes and language name. Refer to the table below. 
    Language nameCodeLanguage nameCodeLanguage nameCode
    AlbaniansqHungarianhuTurkishtr
    ArabicarIndonesianidUkrainianuk
    BulgarianbgItalianitVietnamesevi
    CatalancaJapanesejaAfrikaansaf
    Chinese (Simplified)zh-CNKoreankoBelarusianbe
    Chinese (Traditional)zh-TWLatvianlvIcelandicis
    CroatianhrLithuanianltIrishga
    CzechcsMaltesemtMacedonianmk
    DanishdaNorwegiannoMalayms
    DutchnlPersianfaSwahilisw
    EnglishenPolishplWelshcy
    EstonianetPortugueseptYiddishyi
    FilipinotlRomanianroAfrikaansaf
    FinnishfiRussianruBelarusianbe
    FrenchfrSerbiansrIcelandicis
    GalicianglSlovakskZuluzu
    GermandeSloveniansl
    GreekelSpanishes
    HebrewiwSwedishsv
    HindihiThaith
  • FlagIconURL is the link to the nation flag representing the target language. You can download free flag icons from Custom Icon Design,FamFamFam or MarkFennel.com. Then upload the ones you need to an image host such as Photobucket, Flickr or Picasa. Once uploaded, get the link to each image an use it to replace FlagIconURL.
I’ve put a class name to the code, so you can easily style the flag if you want. Add the codes below before or after the translator code.
1<style>
2.translate-flag img {
3/* add styling codes here */
4}
5</style>

Here is a working sample of actual translator flags and their codes. The first one translates from English to Indonesian, with English interface. The second one translates from English to Spanish with Spanish interface.
IDES
1<!-- Translate flag BEGIN -->
2<!-- by BloggerSentral.blogspot.com -->
3<a class="translate-flag" onclick="href='http://translate.google.com/translate?u='+encodeURIComponent(location.href)+'&langpair=en|id&hl=en'" title="Translate to Indonesian" target="_blank"><img border="0" style="cursor: pointer;"src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjz7vjHxlp_km3x3IuuUlVKlUlkWknAOmbUHrIVkdtEhIdFGaaIzuyNVKvnRLbYgJVQur7f2zovgnDRK5W5hwaWUODpzJf0Z2Q7e-kUPqNo9UQ-gjoPGMjJjH22xh1lNM2D_cXkxwEYAegx/"/></a>
4<a class="translate-flag"onclick="href='http://translate.google.com/translate?u='+encodeURIComponent(location.href)+'&langpair=en|es&hl=es'"title="Translate to Spanish" target="_blank"><img border="0"style="cursor: pointer;"src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYxuCcS3CyzAzMsomqplSlpfA7YzSI6a77iLleghhnPNhzMaEmQMCs5txsuH1O5tSNJ4LPP51nKz7W5FGYtIUPYwywIIFOB9iJMJtoQJNS4gMO_FVTLTcq6WArBH4T85laPpE2dE9aZbG8/" /></a>
5<!-- Translate flag END -->

Enjoy!

Before you leave:
  • Do you find this article useful? Share it via Retweet, Share and Stumble buttons below.
  • Any suggestion, question or comment? Please post it in the comments below.