renjith's blog

thoughts from my perspective

PHP Wrapper for Microsoft Or Bing Translator

What is it all about?

PHP Wrapper for Microsoft / Bing Translator. API is provided by Microsoft . A free subscription gives you 2,000 000 characters a month (which is far better than Google translate as they have stopped free API) . No APP ID is needed to run this program. Please note that Microsoft doesn’t support APP ID any more as it is deprecated. All you need is the account key which you will get immediately after registering with Microsoft at https://datamarket.azure.com/dataset/1899a118-d202-492c-aa16-ba21c33c06cb

In the Initial commit , I’ve added a Demo also which uses Jquery, JSON and AJAX

How to configure

  1. Checkout from trunk (path given in google code home page) or download from http://code.google.com/p/micrsoft-translator-php-wrapper
  2. Get your account key from https://datamarket.azure.com/dataset/1899a118-d202-492c-aa16-ba21c33c06cb
  3. Put your account key in constant ACCOUNT_KEY at config.inc.php
  4. Make changes to other configurations in config.inc.php if necessory
  5. Go to htpp://xxxx/translate

Enjoy translation :)

Wanna see Demo

Go to http://renjith.co.in/translate

Post to Twitter Tweet This Post


Categorized as Technology

11 Comments

  1. Thanks for this
    It Helped me a lot

  2. Hello, I tried the demo. sometime it wasn’t working. I even downloaded the scripts. Sometime it works, sometime it just thrown error like this:

    Warning: file_get_contents(https://api.datamarket.azure.com/Data.ashx/Bing/MicrosoftTranslator/v1/Translate?Text=%27kamu+mau+ke+mana%27&To=%27en%27&$format=Raw&$top=100) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request in C:\xampp\htdocs\translate\class\MicrosoftTranslator.class.php on line 140

  3. Santhosh,kallada says:

    nice one buddy !!

  4. Thanks cheta

  5. This is really strange.. It seems a problem from microsoft end as you can see it is working for most of the other words

  6. Hello!

    This is really a nice php wrapper for bing translator but i have an issue.

    After returning the data and using php method json_decode i get something like this

    textexttext

    the problem is not only the string tag but my text is not in the right encoding-character set , i will make an example

    all the ” à ” are turned to à
    and the ” è ” are turned to è

    How i can fix it?
    Thank you

  7. I want to thank you for your code. I modified it slightly and am using it for as universal translator tool
    for use with Retroshare Chat Lobbies….

    http://retroshare.wikidot.com/ if u are interested…

    Thanks again!

  8. Hello Renjith,

    I am from thrissur. I am trying to do a auto translation module which will convert english text to arabic. When i tried your code: it worked perfectly, but the translated text seems to be in HEXA Decimal format. In your sample, i can see the arabic text perfectly. Is there is anything to be done with the response? Your reply will be very helpfull

    Thanks

  9. I only seem to change course, but it does not work
    1. config.inc
    —————————————————————————
    if (!defined(‘ACCOUNT_KEY’)) {
    define(‘ACCOUNT_KEY’, ‘xxxxxxxxxxxxxxxxxxxxxxxxxxxx’);
    —————————————————————————
    And error messages!
    The authorization type you provided is not supported. Only Basic and OAuth are supported!

  10. Hello Jayant. Massimo
    Can u try changing the charset encoding defined in meta tag

  11. @Jenster.
    Thanks for using my script..

Leave a Reply