Translation Wordpress Plugin Using Google Translate

by lechu on October 4, 2008

I thought of writing a plugin after reading the post by Amit regarding a hack to Translation using Google AJAX Api. This plugin is using the Google Translation PHP class to do the translation. You can check it yourself by clicking on the language link above.

I have released a stable version 1.3 which is working fine with PHP 5. There are some issues with PHP 4. I am working on that and hopefully I will be able to release a version working with PHP 4.

This plugin is working excellent for me and I have got some feedback from some other users who have downloaded this plugin and are using it.

What does this plugin do?

image

As you know that there and different languages used on the world wide web and you get visitors from different country. If you are able to offer the translation in different languages, it will be of real use to your visitors. Translating all your pages to more than 20 International languages manually are practically impossible for a blogger or any individual. There are translation engines which provide this service and I have used the Google Translation API in this plugin.

Even though these engines do the translation work, the translation received needs to formatted properly to display the output as the same as the original ones. I have worked a lot on this and tried to put up the translation results the best way it can. I know that there are some issues, but its acceptable.

This plugin does the following

image

  • You can translate more than 20 International languages.
  • The translation can be done by the visitor using an option selection or just clicking the languages link.
  • AJAX is used, so the translation is provided instantly without the page reload.
  • Every language has a permanent page and the page is stored in the database for future use. If you have made some changes to your post, you can clear the caches and get the new translation done
  • As all the translated pages has a Permanent link, your pages are indexed by the search engines.

Installation

Installation is very simple, just upload the unzipped files to the plugins directory and activate the plugin.

To create pages for each language, you need to modify the single.php file as given below

<h2 class="title"><a title="Permanent Link to <?php $_REQUEST['lang'] ? print translateTitleFromCache($post->ID,$_REQUEST['lang']) : the_title(); ?>" href="<?php the_permalink() ?>" rel="bookmark"><?php $_REQUEST['lang'] ? print translateTitleFromCache($post->ID,$_REQUEST['lang']) : the_title(); ?></a><span class="date"><?php the_time('d M'); ?></span>&nbsp;&nbsp;<? if (function_exists('printPR')) printPR(); ?> </h2>
                <?php //if (function_exists('printLangList')) printLangList(); ?>                    

                <div class="entry">
                <?php if($_REQUEST['lang']) {
                    if (function_exists('googleTranslate')) googleTranslate($_REQUEST['lang'],$post->ID);
                } else {
                    the_content();
                }
                ?>

To generate titles in the translated language, you need to modify the header.php file as given below

<?php if ( is_single() ) {
    if($_REQUEST['lang']) {
        echo translateTitleFromCache($post->ID,$_REQUEST['lang']);
    }
    else {
        wp_title('');
    } ?>&nbsp;|&nbsp;<?php bloginfo('name');
}
?>

Settings

After activating the plugin, just go to the setting link , you will find the Kish Translate settings link Once you go

to the settings, you will find all the options to customize the view of the “Kish Translate” Widget and select the

languages

I need your feedback to improve this plugin, so please post your comments here

You can download Translation Plugin for Wordpress Here

Possibly Interesting Posts

Post on Google Buzz using Voice Search : On Android Phone, you can now post new buzz by just speaking “Post Buzz + Your text to post”. O..[](0)
Should I start a new Email Service? : Two days back I received an email from one of my loyal visitor which reads as follow Dear Kishor..[](0)
Keyboards for Android Phones : Keyboard is something which every phone user has to use the most, for typing emails, messages, etc. ..[](0)
Google Gesture Search for Android Mobiles : While using a mobile, you need to get to your target using the fastest method. For example, you want..[](0)
Making Video Calls on Nexus One – 3G Video Calls : Dhiraagu the service provider today launched the 3G+ network and I wanted to make a video call, but ..[](0)

{ 11 trackbacks }

WordPress Plugins: Translation at WordPress Today
October 7, 2008 at 4:13 am
Páginas » Blog Archive » Plugins
October 7, 2008 at 7:33 am
Inline Translation Using Google Translate In Wordpress | BloggingBandit
October 8, 2008 at 7:02 am
Translate your web pages and get Google Indexed
October 8, 2008 at 7:24 pm
Some Wordpress Plugins You may like to use
October 18, 2008 at 3:57 pm
Ajax Plugin For Wordpres Blog Translation | Kishore
November 15, 2008 at 3:32 pm
» Kish Translate - WordPress Plugins Catalog
November 17, 2008 at 8:23 am
Test driving Wordpress Plugins | thephotographer4you
December 19, 2008 at 11:41 am
4webmasters » Top 1000 WordPress Plugin Authors
December 31, 2008 at 2:12 am
En.nicuilie.eu Blogs » Top 1000 WordPress Plugin Authors
December 31, 2008 at 8:28 am
5 Tips for Blogging in English If It’s Not Your Native Language
January 22, 2009 at 3:43 pm

{ 61 comments… read them below or add one }

Kishore December 20, 2008 at 2:04 pm

Updated version 1.7, hopefully all the bugs are cleared, please post the bugs at http://kish.in/translation-plugin-updated/

Reply

stefand January 15, 2009 at 4:40 pm

Hi, I’ve added the plugin to my site (www.vareseautonoma.net/blog/) but i can’t see the widget to select the language… What’s the matter?

Reply

Kishore January 17, 2009 at 7:33 pm

Have you enabled the plugin in the settings. Please go the setting of Kish Translate and enable. Also please check if you have done the modifications for the theme

Reply

jeff June 9, 2009 at 1:21 pm

Hi Kish!
I added the codes to the header.php but I dont have the single.php because it is a custom page so my programmer of the theme said that single.php and index.php that he made is the same so I added the code to index.php but I dont see the widget showing. I also enabled the theme and have the settings updated.

Reply

Host April 4, 2009 at 11:36 pm

Thanks So Much

Reply

Josh June 28, 2009 at 1:04 pm

this sounds like a great plugin. However I’m not able to get it working.
I put that code in my template files and when i click to translate to a different language it brings me back to my home page but with a url like http://www.website.com/translation/es/post-title.html and everything is still in english. and when i check the folder i created for this plugin ‘translation” there is nothing in there..

could this by my hosting ? or have i setup something wrong.

Thanks!

Reply

Emily July 20, 2009 at 4:02 am

I always read your amazing website every week, its great fun and got lots of interesting information to take in and lots of interesting articles.

Reply

Gabriel September 28, 2009 at 3:37 am

the widget is not appearing in the widgets section, and how do i have to modify the single and header php files, do i have to place the code in some place or sustitute anything?

Reply

Kishore December 1, 2008 at 8:12 pm

English is availabe in the drop down list – The text disappears because you blog back ground is black, this can be corrected by editing the fade function, change the color to a light color

Reply

Kishore December 1, 2008 at 8:14 pm

mb_convert_encoding should be enabled in the php

Reply

Miha March 4, 2009 at 12:35 am

Thanks for the information. It’s very useful for me.

Reply

Leave a Comment

Previous post:

Next post: