PHP Classes

PHP Bing Translate API: Translate texts using the Bing Translator service

Recommend this page to a friend!
  Info   View files Example   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 438 This week: 1All time: 6,262 This week: 560Up
Version License PHP version Categories
bing-translate 1.0GNU Lesser Genera...3.0Localization, PHP 5, Web services
Description 

Author

This class can translate texts using the Bing Translator service.

It takes a given text in a given language and sends a HTTP request to the Bing Translator service to retrieve the translation of the text to another language.

The class can also retrieve the resulting translated text already transliterated.

Picture of razavi
Name: razavi <contact>
Classes: 1 package by
Country: Iran Iran
Age: ???
All time rank: 343069 in Iran Iran
Week rank: 411 Up4 in Iran Iran Up

Example

<?php
/**
 * TestTranslator is a class to test BingTranslator
 *
 * @author Mahdi Razavi <Razavi.Dev@Gmail.com>
 * @version 1.0.0
 * @copyright Mahdi Razavi (c) 2014
 */
 
require_once("BingTranslator.php");

class
TestTranslator
{
   
$textToTranslate = "Test";
   
$srcLang = "en";
   
$dstLang = "Fa";
   
   
$robotTranslator = new BingTranslator();
   
$translatedText = $robotTranslator->translateText($textToTranslate, $srcLang, $dstLang);
   
    if (
$translatedText !== false)
    {
        echo
$translatedText;
    }
    else
    {
       
//If some errors present
       
echo "error:translate";
    }
}
?>


  Files folder image Files  
File Role Description
Plain text file Class.BingTranslator.php Class Bing Translator
Plain text file Class.HttpClient.php Class Http Client
Accessible without login Plain text file Tester.php Example Translator Tester

 Version Control Unique User Downloads Download Rankings  
 0%
Total:438
This week:1
All time:6,262
This week:560Up