Translate Widget
Update! Version 2.0 is here: Translate Widget 2.0
So, I’ve completed my first bona-fide Wordpress Plugin ![]()
It’s one of those newfandangled widgets, and it adds little flags to your sidebar, which will take you to a translation of the current blog page. It uses google translate, but removes the frame, so it looks quite nice! Once you’re in one language, you can browse around the blog, and everything stays translated. You can just click on the English flag to get back to the original language. You should see it on my sidebar now, and you can give it a trial run. Then, if satisfied, download it here:
Translate Widget
The zip includes a /flags/ folder, and a translate.php file. Both need to be placed in the /wordpress/wp-content/plugins/widgets/ folder. If you want to change the English language flag from the default American to either the British or Canadian (as I have!) flags, they are included, just rename flag_ca.gif, or flag_uk.gif to flag_en.gif. Now you can just go to the widget’s options.
Donations
If you appreciate my plugins, and feel compelled to spread some love, I would certainly appreciate it. No obligation though, of course.
Comments, tips, or problems are welcome, just leave a comment here, or send me an email (Address is in the sidebar.)
Do enjoy!
Update on June 14, 2006: The plugin now supports Arabic, since Google has added that to their list of supported translations. This brings the total to 9 languages.
To those not familiar with Wordpress Widgets, you need to have the Widgets plugin installed before you can use my widget.

Apparently 2.2 comes with widgets as part of the core now, so you shouldn’t need to have them installed.
Thanks for the bup reports, guys!
The widget now works with Wordpress 2.2.
oops, found another bug Trevor. It seems google change something with their translate page code. if you click on any flag it goes to an error page.
Actually, that would be me botching up a search and replace in the plugin! Fixed now.
Thanks again.
If I replace the small flags with bigger flags (like 30×20) will it break the plug-in? Just wanted to check before I messed anything up. Thanks much & I *love* this plug-in. Great work!
Mandy,
That should work just fine. Just replace the images in the flags folder, making sure to name them the same as the old ones.
First off, thanks for the great translation widget, Trevor!
I only recently downloaded the widget and noticed a slight problem.
When the code calls google:
http://www.google.com/translate?hl=‘.$orig_lang.’&ie=UTF8&langpair=’.$orig_lang.’%7C’.$langcode.’&u=’.$url; widget_trc_translate_print_flag($langcode,$full_url,$en_flag);
… it refers to a redundant url, causing a “error 404″.
For example, and for the sake of simplicity: on my site, if I wanted to translate english-to-english, the widget calls: http://johnddugan.com/document/document/, instead of just http://johnddugan.com/document/ .
I’m sure this is an easy fix, but I am not versed in .php … any suggestions on how to correct this?
I, also noticed this error is occurring on your home-page as well.
Thanks for your time,
_john
Wow, great plugin! You wouldn’t believe how long it took me to find a translation plugin/widget that was 2.2 compatible.
Good Work!
I have the same problem as Ben and John have, but Ben’s solution didn’t work for me.
[…] Translate Widget Das Plugin fügt kleine Länderflaggen in den Blog ein, über diese kann der Besucher die Homepage mit einen einfachen Klick in seine Sprache übersetzen lassen. […]
Trevor,
I saw your translate widget on someone’s blog and loved it. I was wondering if there is a way to get it to work with Blogger.com?
Trevor,
Your plugin worked great with WordPress 2.2 but after I upgraded to version 2.2.1 today, it triggers a fatal error when I try to activate the Translate plugin.
Yep, I get an error too. The plugin doesn’t work with 2.2
Hey Trevor,
GREAT work!! I have one small issue..under the translate bar I am getting “–>” showing up underneath. Any ideas why..? You can view it at http://www.palmettoculebra.com/
Thanks,
thanks a lot
hi trevor ,..
i have mi blog in spanish ,… so when i put the plugin in spanish, only two flags show me ,.. but if i put in english,.. their load the another flags ,…. can i put in spanish with all the flags?
look http://www.gonzas.net
great widget .,.,.,
bye
Hi Gonzalo,
That’s because Google only supports translating from Spanish to English. So, that’s why only the English flag is showing up.
ok , thks ,….i see your pic in my bloglog ,… chau!!
hi trevor,
i was using your very cool widget until it broke with the update to WP 2.2
are you planning to upgrade it for compatibility with 2.2, or, is there any way to make it work with 2.2 ? i don’t know PHP, so I’d greatly appreciate any info.
thanks,
rd
WOWzer this is what I was looking for.
Thanks a lot for taking the time and coding such a wonderful plugin.
Any plans on making this compatible with 2.2?
ty for the translation widget.
[…] what you write in another language)Here is the information on this plugin. Plugin Name: Translate Plugin URI: Description: Adds a sidebar widget to display languages into which you can translate your blog. […]
Hey Trev,
Very great plugin, can you by any chance add “Traditional Chinese” because a lot of the Asian communities use that instead of Simplified Chinese.
Hola,
I have updated the plugin. I fixed the double url bug, and it should work fine. Get it from the same download location. I’ll be writing a post announcing the new version soon.
thanks for the update
Hello Trevor
I just updated to wordpress 2.2, downloaded your plugin all went well, Now when I go to my site all I see is the word translate but no pictures of the flags are there, what could be my problem? any help would be appreciate Thanks.
Hello Trevor,
Very nice widget! Unfortunately It’s not working correctly in my wordpress 2.2.1.
Two things.
One: The downloaded zip files only contains blank.gif and flags.png. I don’t see a flags folder ?
Two: How should I install this? Should the files go under “widgets” folder or the “plugins” folder ?
Please help!
Thanks!
I have the same problem as clifton
How/where can I force a newline after the Title? I’m sure it’s very basic, I was just hoping you could point me to the necessary line. On your site you have the Title, a horizontal dotted line then the flags. On mine it has the TitleFlagFlagFlag with no break or BR tag.
Very nicely done, btw. Thank you for the updates.