Translation WordPress Plugin Using Google Translate

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

Ajax Translate plugin for WordPress Ajax Translate plugin for WordPress - I am working on a translation plugin which transl
Pagerank Checking Plugin for WordPress Pagerank Checking Plugin for WordPress - I have written a simple wordpress plugin for disp
AJAX Twitter plugin for WordPress AJAX Twitter plugin for WordPress - I have been working on a plugin which I had early
Writing your own WordPress Plugin Writing your own WordPress Plugin - Wordpress plugin is an addon for Wordpress blogs
AJAX Twitter plugin for WordPress AJAX Twitter plugin for WordPress - I have been working on a plugin which I had early

About Lechu

Lechu is a part time blogger, full time home maker, interested in cooking and teacher by Profession. She works as a chief editor of this blog, helping in publishing Guest Posts as well as writing on topics of her interests.
This entry was posted in Plugins, Projects, Wordpress and tagged , , , , , , , , , , , , , , . Bookmark the permalink.

72 Responses to Translation WordPress Plugin Using Google Translate

  1. Pingback: WordPress Plugins: Translation at WordPress Today

  2. Pingback: Páginas » Blog Archive » Plugins

  3. Dumu says:

    Nice lpugin,but it is strange that there were no English option.

  4. Dumu says:

    I suggest that an increase in the local language options, which can be in different languages on the Web site to be used.

  5. Avinash says:

    Kish, thats a gr8 plugin but for me its not working on translating its showing me nothing on translation.

    You can check it out at my site.

  6. Kishore says:

    @Damu, I have english, I will be adding new languages in next version which will be released soon
    @Avinash, I think its a problem with the server path, can you please download the latest version and update the funtions.php file. I have added a patch for this issue.

  7. Avinash says:

    Kishore, Its still the same, any download link from your server

  8. Pingback: Inline Translation Using Google Translate In Wordpress | BloggingBandit

  9. Pingback: Translate your web pages and get Google Indexed

  10. baron says:

    hi. Thanks for plugin

    perfect.

    Regards

  11. Avinash says:

    @ Kishore : Ive tried the 1.3 version and iam getting this error,

    Fatal error: Call to undefined function: json_decode() in /home/public_html/bloggingbandit/wp-content/plugins/kish-translate-ajax/googleTranslateTool.class.php on line 144

    You can check it out on my site !!
    And Iam also not sure why Iam not getting the lang in the link, on mouse over the langauge rather it is pointing to ##

  12. Kishore says:

    Avinash – thats because of the PHP Version json_decode() is in PHP 5. I guess you are using PHP 4, I have a patch for this, but I have not tested it as I have my servers with PHP 5.2. Please download this and overwrite the exisisting files
    http://kish.in/wp-content/downloads/kish-translate-ajax.zip

  13. Amit says:

    Excellent plugin, Great job

  14. Avinash says:

    Its not translating but giving an option clear cache, clear cache all

    on clear cache it says Error clearing cache..DELETE FROM wp_kish_translate WHERE pageid = 85 AND langid = ‘fr’ LIMIT 1

    on clear cache all, it says error cleaning cache,

    check if needed

  15. Kishore says:

    Avinash, I am unable to Debug as I do not have PHP 4. Its works perfectly with the latest version of PHP.

  16. Avinash says:

    Its ok Kishore, thanks for your efforts.My hosting is still on php 4.2.4, so shall try the plugin later.

  17. rivermaya says:

    Hi,
    is it can overload the hosting space ?

  18. Kishore says:

    @rivermaya – No, there are no chances of overloading the hosting space. The file are very small

  19. rivermaya says:

    I thought because it will generate many languages for each post it will overloading hosting space ..

    this is great plugin, thanks Kishore ..

  20. Kishore says:

    @rivermaya – it creates pages in the DB and you have an option to clear the cached pages if you feel that your DB size is increasing. I am using this plugin for posts about 1000 and its not giving any trouble

  21. Kevin W. says:

    good article, very useful.

  22. Leon says:

    Hi Kish,

    I love the idea and i installed the plugin.
    Unfortunately it shows blank after translation.

    You can check my site using the link above

  23. Kishore says:

    Leon – which version of php are you using? Does your server has curl library enabled?

  24. Leon says:

    Hi Kishore,

    I have on the (CentOs) system:
    /usr/lib/libcurl.so.3
    php.i386 5.1.6-15.el5 installed

    from php info:
    CURL support enabled
    CURL Information libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5

    Installing curl-devel and a restart of the httpd didn’t help

    Regards

    Leon

  25. Kishore says:

    Leon – need to check, it should work for sure.

  26. dumu says:

    Thanks Kishore, Great job.

  27. Tajger says:

    Nice plugin, using it on one of my sites!
    However, on the second of my sites it does not work.

    Getting this error when trying your plugin:
    Warning: curl_setopt() [function.curl-setopt]: Unable to access cookie in ../wp-content/plugins/kish-translate-ajax/googleTranslateTool.class.php on line 182

    Running PHP 4.4.4.

    Got any ideas?

  28. Kishore says:

    -Tajger – I am sorry, I have not tested in php 4.4, and you need the curl library enabled on your server, you can ask your hosting company to do this.

  29. rivermaya says:

    Hi Kishore, it’s me again :)
    I just found that the translated always repeat the original title without translating it. I tried remove few codes within but nothing change.

    and why the border for drop down country in that site is different (too long) than I installed on other site ?

    kindly look at my site, please ..
    thank you

  30. Kishore says:

    -rivermaya, I think its because of the template, can you try setting the width of the option box in the funtions.php file
    .optionlang {
    font:Verdana, Arial, Helvetica, sans-serif;
    font-size:12px;
    width:30px; /*Add this line */
    }

  31. rivermaya says:

    thank you for the width code, it’s work :)

    I’m still figuring out about the repeated title within the template code, at least not too big

  32. Kishore says:

    -rivermaya, you can change that by editing the h1 tag. Its in line number 530, 540 and 544 of the functions.php file. You can change to either or what every your like or suits your page

  33. rivermaya says:

    great, all things fine now

    thanks for the support ;)

  34. Pingback: Some Wordpress Plugins You may like to use

  35. techshore says:

    Could u please arrange widget for wordpress.com

  36. K. Pinckney says:

    I keep getting this error:

    Fatal error: Call to undefined function: register_sidebar_widget() in /home/sites/sitename.com/public_html/wp-content/plugins/kish-translate-ajax/functions.php on line 693

  37. Kishore says:

    Pinkey – Which version of wordpress are you using? Is your theme widget enabled

  38. K. Pinckney says:

    I am using 2.1.1

  39. Kishore says:

    I have tested only on 2.3

  40. gh3 says:

    Nice job very useful plugin.
    Now is not working on my blog was Ok in WP 2.6.2 but in WP 2.6.3 is taking very log time to work o text with no result, i will try to see where is the problem.

  41. Nice plugin; but doesn’t seem 2 go so well when original language is indic like say tamil!

    But otherwise very neat… Thanks!

  42. Agam says:

    I hope this plugin can translate comments too.
    Thanks a lot for this wonderfull plugin.

  43. Thanks, this is one of the better posts I’ve read today. I share your vision about that. Thanks man!

  44. Hi,
    The plugin used to work sometime back; now I get a clear cache on
    trying to convert and when I click the link to clear cache I get this:

    Error clearing cache..DELETE FROM wp_kish_translate WHERE pageid = [pageid] AND langid = ‘[lang-code]‘ LIMIT 1

    What went wrong? I use Php 5…

  45. Kishore says:

    -Rajesh, Its a DB Error, I am going to release a tested stable version in a couple of days. Please hold on

  46. Pingback: Ajax Plugin For Wordpres Blog Translation | Kishore

  47. Pingback: » Kish Translate - WordPress Plugins Catalog

  48. Hello Kishore
    I’m trying to use your plugin on my own blog. But i got an error like this

    Call to undefined function mb_convert_encoding() in /home/bursa/public_html/incridiblog.com/wp-content/plugins/kish-translate-ajax/functions.php on line 554

    How should i do?

    Thanks a lot for your time.

  49. im getting this error when trying to translate:
    ———————-
    Fatal error: Call to undefined function mb_convert_encoding() in /home/phat/public_html/wp-content/plugins/kish-translate-ajax/functions.php on line 542
    Permalink To Available Translations

    ——————-

    another streange thing is that under the permalinks in only getting arabic language and not the other languages
    ———————–

    Permalink To Available Translations

    Arabic | Kish Translate Ajax
    —————————

  50. forgot to mention that i have a wordpress 2.6.2 blog with php5

  51. dario says:

    Hi! I love this plugin but why dont appear english even when is checked on the wordpress settings?

    pls check http://www.blackberrylatino.com/website-para-descargar-mp3-desde-tu-blackberry/

    there is a fade when is translated the text…

  52. Kishore says:

    I am working on a new version with all the bugs to be cleared soon, hopefully I will updated the wordpress extend directory in a weeks time

  53. @Kishore, I am Turkey. but plugins not turkish languages options :(

  54. Kishore says:

    @ismail – I have used Google Translate API and the availability of langauge is restricted to the the Google Translate API

  55. Kishore says:

    I have uploaded a new version of Translation Plugin, which generates SEO Friendly Pages

  56. Pingback: Test driving Wordpress Plugins | thephotographer4you

  57. dee says:

    Your plugin has stopped working with my WordPress 2.7 Coltrane upgrade. Please advise….I really would love to continue to use this plugin. I have a lot of traffic from abroad. Thanks a million.

  58. Kishore says:

    dee – Please upgrade the plugin to latest version, Please hold on for version 1.7, which should be updated in 2-3 days, I have tested the plugin on 2.7

  59. Kishore says:

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

  60. Pingback: 4webmasters » Top 1000 WordPress Plugin Authors

  61. Pingback: En.nicuilie.eu Blogs » Top 1000 WordPress Plugin Authors

  62. stefand says:

    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?

    • Kishore says:

      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

      • jeff says:

        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.

  63. Pingback: 5 Tips for Blogging in English If It’s Not Your Native Language

  64. Josh says:

    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!

  65. Emily says:

    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.

  66. Gabriel says:

    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?

  67. Kishore says:

    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

  68. Kishore says:

    mb_convert_encoding should be enabled in the php