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 enough user ratingsTotal: 438 All time: 6,264 This week: 524Up
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: 343170 in Iran Iran
Week rank: 307 Up9 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:0
All time:6,264
This week:524Up