Google translator plugin for blogger

This is a simple workaround that will help you embed a translator option for your blog/site.

There are a lot of translator plugins available at the moment like the Altavista Babel translator plugin. Despite being very good plugins(javascript code linking to altavista site) they cannot be modified to suit your site’s theme. They simply stick out. Even the Yahoo Babel plugin recommended by Amit is not fully customizable to your blog theme.

Comes Google with it’s wonderful translator tool. But no ready made widget for your blog at the moment. No worries - let’s play with it and make one!

Before implementing this plugin(wonder if it can be called one!) to your blog just learn some few translator language.

When ever you translate a webpage using the Google translator tool - the resulting url will be similar to this. -

http://google.com/translate?langpair=en%7Ces&u=thewebsiteurlhere

Note the two red coloured letters - en is Google’s code for English and es is for Spanish.

Similarly Google has various codes for each country. Using these codes ihave managed to make a javascript enabled pull down menu that simply transalates any page to the currently selected language.

Here is the code -
=================================

<FORM NAME=”nav” width=”100%”>

<DIV>

<SELECT NAME=”SelectURL”onChange=”document.location.href=document.nav.SelectURL.options
[document.nav.SelectURL.selectedIndex].value”>

<OPTION VALUE=”http://google.com/translate?langpair=en%7Cen&u=http://dailydose4me.blogspot.com”
SELECTED>Translate this blog

<OPTION VALUE=”http://google.com/translate?langpair=en%7Ces&u=http://dailydose4me.blogspot.com”>
Spanish

<OPTION VALUE=”http://google.com/translate?langpair=en%7Cit&u=http://dailydose4me.blogspot.com”>
Italian

<OPTION VALUE=”http://google.com/translate?langpair=en%7Cfr&u=http://dailydose4me.blogspot.com”>
French

<OPTION VALUE=”http://google.com/translate?langpair=en%7Cpt&u=http://dailydose4me.blogspot.com”>
Portuguese

<OPTION VALUE=”http://google.com/translate?langpair=en%7Car&u=http://dailydose4me.blogspot.com”>
Arabic

<OPTION VALUE=”http://google.com/translate?langpair=en%7Cja&u=http://dailydose4me.blogspot.com”>
Japanese

<OPTION VALUE=”http://google.com/translate?langpair=en%7Cko&u=http://dailydose4me.blogspot.com”>
Korean

</SELECT>

<DIV>

</FORM>

=================================

You may modify the website url to your blog.You may also want to add more language sets by simply converting any webpage(at Google translator) into your desired language and then copying the country code from the resulting url.

I prefer this one because it sinks in with your blog theme perfectly, unlike that Altavista Yellow fish.

See the demo on the top left menu(below the technorati tag).

Comments 4

  1. Wendell wrote:

    Didn’t work (?). Didn’t work in mmine (blogger ‘beta’), and doesn’t seen to work in yours. I’m using F.fox. Would that make a difference?

    Sorry, and thks anyway.

    W.

    Posted 05 Jan 2007 at 11:00 pm
  2. .::[ Mani Karthik ]::. wrote:

    Hi Wendell
    The script works perfect here.
    Probably its about the code - something broke off when you pasted - i guess. ive sent you an email with the right code. Please try it and let me know.

    Posted 06 Jan 2007 at 5:56 am
  3. Anonymous wrote:

    Hi Mani!

    Thanks so much for this translation code! Just what I needed and working perfectly in my blog!

    Great site Mani, keep up the good work!

    Posted 13 Jan 2007 at 1:32 pm
  4. Rupesh wrote:

    hi,
    check out this translation tool for individual blog post. http://fundubytes.blogspot.com/2007/06/language-translation-tool-for-new.html

    Posted 22 Aug 2007 at 2:17 pm

Post a Comment

Advertise here