Converting the alphabet to php
1 answer
You can use the Google AJAX Language API to convert. 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;
}
?>
+6
a source to share