views:

43

answers:

2

Hi,

Is there a way i can change the spanish word which i have typed in the textbox to its english word in php.

Is there any way to do this in php.

Please help me

Thanks

+6  A: 

You can use the Google AJAX Language API to do conversion. For example:

google.language.translate("Hello world", "en", "es", function(result) {
  if (!result.error) {
    var container = document.getElementById("translation");
    container.innerHTML = result.translation;
  }
});

that's Javascript. There is a PHP port.

<?php
/**
* example usage
*/

// we need the page treated as utf-8, otherwise the encoding will be mangled
header('Content-Type: text/html; charset=utf-8');

// require google language api class
require_once('google.translator.php');

// translate text
$text = 'Welcome to my website.';
$trans_text = Google_Translate_API::translate($text, 'en', 'it');
if ($trans_text !== false) {
        echo $trans_text;
}
?>
cletus
here in ur code link where i can find google.translator.php
tibin mathew
Thank you very much
tibin mathew
A: 

check this page here and let me know if it helps or not

Gaurav Sharma