Posted on Mar 25, 2007 - 1:45am by John P. in Google Tools, Wordpress

The Google Translator plugin allows Wordpress to add a number of alternate languages to your blog.
This plugin is derived from Scott Hough’s WP Translate, but makes a number of changes:
Download Google Translate v.3.24.07
Google Translate should work in all versions of Wordpress 1.5 and newer.
To add Google Translate to your web page you will need to edit your templates to include the function.
For a horizontal layout add the following:
<?php if(function_exists(’google_translate’)) google_translate(2); ?>
For a vertical layout add the following:
<?php if(function_exists(’google_translate’)) google_translate(1); ?>
If you would rather include the translation in a Widget sidebar you will first need to add a plugin which allows you to execute PHP within the sidebar. I recommend the ExecPHP plugin.
After installation and activation of ExecPHP you can include the Google Translate function within the sidebar Widget area.
This plugin is distributed freely, just like the original. Feel free to use it, change it to meet your needs, etc. If however you re-distribute it you must include links and reference to Scott Hough and John Pozadzides.
If you find this little widget helps you out and you’d like to return the favor, please provide a link back to One Man’s Blog. Or at least drop me a comment below to let me know it helped out.
Enjoy!
I use the "No Adverts for Friends" plugin by Donncha O Caoimh
[...] Google Translate Wordpress Plugin By The Man Overview The Google Translator plugin allows Wordpress to add a number of alternate languages to your blog. This plugin is derived from Scott Hough’s WP Translate, but makes a number of changes: The Google Translate service is used, … One Man’s Blog - http://onemansblog.com Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages. [...]
[...] Hopefully they will include the other languages as soon as possible. Until then, I would advise against using the translation plugin. [...]
Hey John P.,
i would like to thank you so much for this free translation tool, I searched so long for that kind of wordpress plugin but only got commerical ones.
I immediately set it up on my website http://www.picsandclips.de and it works perfect.
This is by far one of the best wordpress plugin I`ve ever seen.
Chris Palmer
Great script, tanks you. I’m trying to implament it in my website - http://www.turnkeyforms.com but I wander why not use follow. Google duplicated content issue?
Hi John,
I downloaded your plugin, but no it doesnt work. There’s nothing on display in my sidebar when I added the code in my sidebar.php file.
Nope, unfortunately I don’t see any flags.
I’m not using widgets, just adding the php code.
Darrin,
Can you give me a link to your blog, and also tell me what version of Wordpress you are running?
John
John…Thanks for your plugin…However, I have the same problem on my blog. Nothing happens…I tried horizontal and vertical layout…did everything that I was supposed to, but nothing seems to be working…not in the sidebar, or header.php or footer. I am not well versed with php…can you help me out here..it must be small tweak that must be needed…Thanks
Darrin and Trakin,
I’m sorry you had those problems. It looks like there was a problem with my insert statement. I’m not sure why because I’m certain I’ve tested it properly before and it was working. Furthermore I see nothing wrong with it now…
Anyway, please use the following to insert the flags into the page, but only after enabling the plugin. For horizontal:
<?php google_translate(2); ?>For vertical:
<?php google_translate(1); ?>Let me know how that turns out for you. In some installations you might need to add some style to your stylesheet and I might need to adjust the plugin a bit for you to get it to look nice. But I’ll wait to hear back before making changes to it.
John
John….perfect…Works like a charm… Really appreciate all the help you provided….Just wanted to know if you are going to have future versions of this plugin, which will have permalinks…the one that global translator or angshuman’s paid translator plugin has ???
That would be great….It helps in search Engine traffic. I guess the pages converted via this plugin may not be indexed by google…
Trakin,
I specifically designed this plugin not to be followed by search engines out of fear of being penalized for having duplicate content. However, it is very easy to change that…
If you edit the PHP document and delete ALL instance of,
rel="nofollow"it will make all the various languages discoverable.Have fun!
John
Thank you John…
you have been a great help !
This is exactly what I was looking for. I hope it works, as I tried some other solutions which failed.
[...] Visit [...]
Hi John,
it works great, just like the other guys over here I am a happy user of this wordpress plugin.
But could you add in a future version of this plugin more languages like arabic and some other exotic ones?
I don’t know why it is doing this. It seems a little strange to me.
It does all you say but when I click on ‘Chinese’ or ‘Russian’ I get a large white box in the left top corner and the page never stops loading. All the other languages work normally so I don’t know what is going on. I only get this white box when using firefox (2.0.0.4). I tested it out with IE and the white box never shows up.
[...] Source Code syntax highlighting plugin за WordPress FeedBurner FeedSmith Link Harvest на Alexaking Google Translate Wordpress Plugin [...]
Thanks you 4 nice help & nice blog. I have asite under construction on googlepages can i add a hyperlink 4image except 4 html codes because i need add another languages
Hi,
I couldn’t get this working on my blog. I got WP Translate from Scot working though so not sure why it is.
Tried to use it in a sidebar widget and nothing showed. WP Translate is in an working
Tried to use it out of the widget area and none of the icons were showing and I found that it had not picked up my full blog URL (it’s in a ‘blog’ subdirectory) but the plugin was looking for all the images in root/wp-content….etc so wonder if that’s why the whole plugin is bust.
Any advice?
I reinstalled my blog to the root so it all runs from http://www.yourinternettravelguide.com/.
The flags show up but all the links are only ever to the index.php page and never to the page or post I have selected.
Seem to be so close….
Sorry, been a dunce. Doesn’t work with permalinks on…
Any news on this being available?
David,
Find:
function google_translate($vh) {
$currenturl = $_SERVER["PHP_SELF"];
if ( $_SERVER['QUERY_STRING'] ”) {
$currenturl .= “?” . $_SERVER['QUERY_STRING'];
}
Replace with:
function google_translate($vh) {
$currenturl = $_SERVER["SERVER_NAME'"];
if ( $_SERVER['REQUEST_URI'] ”) {
$currenturl .= $_SERVER['REQUEST_URI'];
}
Good luck.
I tried this recommendation, but after I tried to save the changes Wordpress inactivated the plugin due to errors. JUst wanted to double-check to see if this indeed is correct?
I pasted here the solution but it seems the code can’t be properly included . You just need to add two angle brackets together (first the ‘less than’, and after the ‘greater than’) without an space between them, after this:
['REQUEST_URI']in the third line.
It works - très bien!
I implemented your plug-in this afternoon and like it a lot. I wanted to have readers go off to Google to read, rather than trying to integrate the translation into my site ’cause I can’t make WP permalinks work at all, which the other translation plug-ins pretty much require. BTW, the Google translations are really pretty bad, but better than nothing.
Your plug-in does not work with blogs that are installed in subdirectories because you made the assumption that the icons would be in /wp-content/plugins/google-translate/ which is incorrect if a blog (like mine) isn’t located at the DocRoot of the server. This is probably what “David” (above) was running into.
If you’ll contact me by email (John) I’ll send you the fixed-up file. It basically requires using the function get_bloginfo(’wpurl’) to pick up the URL for the installation directory and then dropping that into the SRC= in the code where you inserted the flag icons.
Google now offers Hindi translation, it’s not in this plugin yet (as of May 28, 2008), but all you have to do is add the Indian flag image to the images folder and then add this line of code, just underneath the Chinese translation:
<a title="Hindi" rel="nofollow" href="http://translate.google.com/translate?u=&langpair=en%7Chi&hl=en&ie=UTF8"> Hindi