PHP Classes

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

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 439 All time: 6,263 This week: 68Up
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

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 (3)  
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

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:439
This week:0
All time:6,263
This week:68Up