| 
<?
/**
 *  IAM_BabelFish_Translate A class for translating text and URLs using Yahoo's BabelFish translation service
 *  @desc IAM_BabelFish_Translate A class for translating text and URLs using Yahoo's BabelFish translation service
 *  @package IAM_BabelFish_Translate
 *  @author  Iván Ariel Melgrati <[email protected]>
 *  @version 1.0
 *  @copyright 2008
 *
 *  Requires PHP v 4.0+ with the cURL extension loaded
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License as published by the Free Software Foundation; either
 *  version 2 of the License, or (at your option) any later version.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 */
 // Flag UTF-8 text is coming
 header("Content-Type: text/html; charset=utf-8");
 ?>
 <html>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 </head>
 <body>
 <?php
 // Include Class definition file
 require_once("IAM_BabelFish_Translate.class.php");
 
 // Create translator instance
 $translator= new IAM_BabelFish_Translate("en");
 
 // Set test Languages
 $test = array("nl"=>"Dutch", "fr"=>"French", "de"=>"German", "it"=>"Italian", "pt"=>"Portuguese", "es"=>"Spanish");
 foreach($test as $code=>$lang)
 {
 // Set target language
 $translator->setDestinationLanguage($code);
 
 //Print translation results.
 echo "<b>$lang</b>: ". htmlentities($translator->translateText('This is a quick test')) ."<br /><br /><br />";
 }
 ?>
 </body>
 </html>
 |