Libin's Blog Libin's Blog
Search
Introducing the Google AJAX Translation WordPress Plugin

UPDATE:

Please see this page for the new version: Google AJAX Translation 0.2.0

Google just released a new API yesterday: Google AJAX Language API.

AJAX Language API is built on top of Google Translate, it current supports 13 languages and 29 translation pairs. It is new but it is already very powerful. If you want to know more about how to use it on your website, please see Google AJAX Language API Document for more details.

We in Savvica want to use this cool technology in our awesome website: LearnHub.com. In the middle of doing this today, I was thinking about to enable this feature on my blog too. :)

So, here we go, the Google AJAX Translation WordPress Plugin is arrived.

Please download from here:

http://wordpress.org/extend/plugins/google-ajax-translation/

Installation is very simple:

  1. Download the plugin archive and expand it
  2. Put the ‘ajaxtranslate.php’ file into your wp-content/plugins/ directory, or put the ‘ajaxtranslation’ folder into your wp-content/plugins/ directory.
  3. Go to the Plugins page in your WordPress Administration area and click ‘Activate’ for Google AJAX Translation.
  4. Have fun with your blog readers.
  5. Please see my blog as an example

Couple things still need to know:

  • Google Ajax Translate only allow 500 characters right now (March 2008)
  • So this plugin only supports translating the first 500 characters of your blog comments
  • In the current version(0.1), I only enable comment translation by default. There are two reasons for this:
    • Most of your posts are more than 500 characters, but most of your blog comments aren’t
    • Google will translate characters inside of html tags, which will mess your blog for sure
  • If you still want to use it with your post too, please comment out line 79 in ajatranslation.php
  • This is just an initial release, lots of feature will be added in. Please stay tuned.

If you want to do some changes and glad to share with all of us, please feel free to comment here or send me email @ libin.pan at gmail dot com.

I hope you will like it.

Want to know more?

arrow55 Responses

  1. 80 mos, 2 wks ago

    Welcome!

  2. 80 mos, 2 wks ago

    Please click the links below to try it. Enjoy!

  3. 80 mos, 2 wks ago

    Awesome of you to get this out so quickly! I will be working on a Drupal module soon. I posted about the first few hours I spent messing around with the API, and like you I made my comments translatable ;]

  4. 80 mos, 2 wks ago

    Thanks, Dave!

    I just take a look on your blog. Your implementation looks great!

    I really like your idea about Facebook and twitter. 500 characters limit sound perfect for these shout wall posts or status.

    I was thinking use uOGT in another day, but found my website will be soon rejected by Google Translate Service. This AJAX one really helps!

  5. 80 mos, 1 wk ago

    Request for adding into WordPress Plugins List has been approved today. So please download from
    http://wordpress.org/extend/plugins/google-ajax-translation/

    And all the new changes will go there too.

    Thx!

  6. Phoenix
    80 mos, 1 wk ago

    插件不错,但是想要全文翻译的话应该如何设置呢?

  7. 80 mos, 1 wk ago

    Thanks Phoenix!

    To enable fulltext translation, mine may not be a perfect solution at this moment. As Google limits 500 characters for every request.

    But you still can give a try:
    Uncomment line 79 in ajaxtranslation.php

    If you want to have a more professional one, please give a try on:
    http://wordpress.org/extend/plugins/global-translator/#post-2877

    This is the best one I’ve found so far. But too bad it is not free.

  8. Saen
    80 mos, 1 wk ago

    This is a great idea!

    However, the first paragraph of my comments are being bolded since I activated this plug-in. Has this happened to anyone else?

  9. 80 mos, 1 wk ago

    Thanks Sean!

    The problem has been fixed. Please download from wordpress for the new version and overwrite your exist one.

    Please feel free to let me know if it works for you.

  10. 80 mos, 1 wk ago

    Its Fun, Entertain For Visitor To Leave Comment :D

  11. rama
    80 mos, 1 wk ago

    is this only for WordPress? i need to find language translation API , but it not online, it should work on my localhost!

  12. 80 mos, 1 wk ago

    Yeah, the plugin is only for WordPress. But the AjAX Language API is not.

    I am not really sure about how you want to make it wok on localhost.

    The AJAX Language API is a AJAX wrapper for Google Translate Services. If you want to use it, you need the access to the Google servers, which means you need to be online.

    As long as you have internet access, it doesn’t matter you call it from your hosted server or your local machine. It should work.

  13. rama
    80 mos, 1 wk ago

    actually i wnt to develop a chat program, which run only in internal network(most probably no internet facility available), so i need to store tht translation api in my local server!, is there any way to do this?

    thanks for u reply!

  14. 80 mos ago

    Thanks Libin, it works great. I am translating my posts too, but problem is that my post images do not display when after user clicks alternate language. Any ideas? Please see http://dave.jp.

  15. 80 mos ago

    Hi Rama,

    Your idea sounds very interesting! Put internationalization into chatting is absolutely a great feature. But I am afraid that you may need a translate services inside your internal network if you want to make it work without internet access.

    Some professional translation companies have this kind of software. But I believe the price will be way more higher than what we expect.

  16. 80 mos ago

    Hi David,

    Your blog looks very beautiful!

    Let me tell you what plugin does for translation. When the user click “View Post/Comment in ??? Language”, plugin will get the innerHTML of the current post/comment, then filter out all the html tags, such as
    < p >, < a href=..>,
    then send the pure text to google and wait for the translated result.

    The reason for filtering html tags out is: if you send them within your text, google will translate the words inside of tags and return it back. Which will mess up the whole page.

    I am trying to find a better solution for this, but no lucky yet.

  17. 78 mos, 2 wks ago

    Google now added more languages to their API.
    The problem is that it’s too many.
    is there any way for the language select to be in a dropdown menu (some thing like the google translate mypage tool
    P.s
    Great plug in I love it!!!

  18. 77 mos, 2 wks ago

    Nice job!

    But how can I remove some of the languages which I don’t want to be translated?

  19. 77 mos, 2 wks ago

    Thanks Clementtang!

    I am working on the next version now, which will have the options for choosing languages, but for now, you could just edit wp-content/plugins/ajaxtranslation/ajaxtranslation.php.

    From line 46 to 58, remove anyone you don’t want and it should work.

    Let me know if you have problem. :)

  20. 76 mos, 3 wks ago

    WOW thanks… I was looking for this plugin… and now will wait for a new one..

  21. 76 mos, 1 wk ago

    Hi Libin, thx for ur work^^
    I’d like to ask if this plugin supports Linux/Mac OS, it is not working on my iMac(Leopard + Safari + Firefox), thx.

  22. 76 mos, 1 wk ago

    Thanks so much, loewez!

    The problem is in the theme what I am using now. It was missing one line which is very important:
    < ?php wp_footer(); ?>

    I’ve added it back. So the translation plugin should be working again.

  23. 76 mos, 1 wk ago

    Yeah it works now, thank u for ur speedy reply^^

  24. 76 mos, 1 wk ago

    You are more than welcome!

    You may notice this already, the translation plugin does work on Admin/Comments list too. :)

  25. 76 mos, 1 wk ago

    Hello Libin,

    unfortunately it does not work on my blog! No idea why..

    have a look here
    http://www.tecnopolis.eu/blog/2008/05/alla-ricerca-del-gadget-che-c%c2%b4e-nokia-n95/#comment-31

    I am running WP 2.5 + several plugins (among them Get Recent Comments).

    Thank you in advance for any help!

    cheers, Alex

  26. 76 mos, 1 wk ago

    ops.. yes I reactivated it. Still not working

  27. 76 mos, 1 wk ago

    Looks like it is the same problem as I had. Could you please let me know what theme you are using, or you can just open :
    …/wp-content/themes/your current theme/footer.php
    Try to find if it has
    < ?php wp_footer(); ?>

    If not, please just add it in before < / body >
    Hope this will fix the problem. Let me know if it still doesn’t work.

  28. 76 mos, 1 wk ago

    HI Libin,

    I tried your tip, yes it hadn’t the wp_footer linecode. Put it, but still nothing.

    My theme is a modified Effercio Blue theme
    http://cdharrison.com/2007/09/01/effercio-blue/

    I can provide you any file by email.

    thanks, A.

  29. 76 mos, 1 wk ago

    OK. It’s my fault. :)
    Please remove the space between < and ?.
    The line of code is:
    < ?php wp_footer(); ?>

    The space here was added by wp, so it could be displayed.
    Please give it a try again.

  30. 76 mos, 1 wk ago

    yeah.. it works finally!

    Many thanks, great plugin

    cheers, Alex

  31. 76 mos, 1 wk ago

    You are more than welcome! Glad to hear this thing is useful. :)

  32. 76 mos ago

    Thanks Michael Klein for implementation of flag links!

    Say Hello to Google AJAX Translation V0.2.0!

  33. 75 mos, 2 wks ago

    Hi there! I always love to google for WordPress Plugins as I always find nice site like yours. Everyday there are new plugins and themes for wordpress and so you can pimp up your installation from time to time. :-) Btw: Your article cing the Google AJAX Translation WordPress Plugin | Libin Pan was the best I found today! Regards! Jens

  34. 75 mos, 1 wk ago

    Great i love this

  35. sam
    74 mos, 3 wks ago

    sorry if i double posted, but i was wondering if there is a way to use this for Posts and Comments, but not for Pages.
    thanks!

  36. 73 mos ago

    Warning: Invalid argument supplied for foreach() in C:\AppServ\www\wordpress\wp-content\plugins\google-ajax-translation\ajaxtranslation.php on line 199

  37. 73 mos ago

    when i setup new theme the code is unvaliable…

  38. 73 mos ago

    Please visit my site:www.vietproblog.com and tell me about it’s error.Thanks u very much

  39. 73 mos ago

    Thanks for the awesome plugin.

    I tested the plugin on my site. My site used FeedWordpress plugin to collects feeds from other sites.

    There is problem is that Google AJAX Translation WordPress plugin doesn’t display any flags in the rss posts, but in manual posts the plugin worked fine.

    Is there any fix soon?

    Thanks for kind support

  40. 70 mos, 3 wks ago

    Which one is better ? this one or the n2h one ?

  41. Daniel
    69 mos ago

    you can change in php file if you want more than 500 characters… Why only 500???????????

  42. 68 mos ago

    Ando perdido la pagina no traduce todo el articulo? la pagina en la que instale ese plug in solo me traduce una parte alguien sabe porque?

  43. 67 mos, 1 wk ago

    Очень полезно

  44. 66 mos ago

    Hi and thanks for a good plugin!
    I want to know how i call the translate function manually. IE so I can place the “translate” link where I want and not automatically and the end of each post.

    Cheers

  45. 66 mos ago

    Hi and thanks for making this awesome plugin!! totally awesome ;-)

    However the plugin only translates our pages and not posts. The translate button it present on both, the drop down appears on both etc but when you select a language (in a post) nothing happens. any ideas?

    we’re a music charity based in London, UK with a global following so this plugin is unbelievable for us. Thank you sooo much x

  46. 65 mos, 3 wks ago

    Hi Emil and Steve,
    I may be able to help you with your questions but it’s easier if you start a thread on the WordPress forums.
    http://wordpress.org/extend/plugins/google-ajax-translation/

  47. jonathan
    65 mos, 2 wks ago

    You post is very helpful to me and I

  48. 65 mos ago

    Hey, the translator rise average time my visitors, very useful. Thanks,.

  49. george
    65 mos ago

    It’s a great tool but I have this problem: it translates comments but it can’t translate posts. Testing with WP 2.8 both latest IE and Firefox. Any idea please?

  50. 58 mos, 2 wks ago

    Although post is nice but I am not agree with all the points. Any way best as compare to others…

  51. 48 mos, 3 wks ago

    Intriguing. Have been trying to learn a new language for a while so this is extremely relevant! Thanks.

  52. 43 mos, 1 wk ago

    can i translate to malayalam?

  53. 43 mos, 1 wk ago

    THX that’s a great awnsre!

  54. 43 mos ago

    Why i can’t install OnTranslator on my macbook? Can’t understand what the problem. Does anyone uses that translator?

  55. 41 mos, 2 wks ago

    cool information Thank you very much!

Leave A Comment