PHP Classes

File: Tester.php

Recommend this page to a friend!
  Classes of razavi   PHP Bing Translate API   Tester.php   Download  
File: Tester.php
Role: Example script
Content type: text/plain
Description: Translator Tester
Class: PHP Bing Translate API
Translate texts using the Bing Translator service
Author: By
Last change:
Date: 10 years ago
Size: 596 bytes
 

Contents

Class file image Download
<?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";
    }
}
?>