Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Ö. Karatag  >  karatag Google Translation  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example File to test the translation
Class: karatag Google Translation
Translate Web pages with Google Translator
Author: By
Last change:
Date: 2007-05-11 06:01
Size: 810 bytes
 

Contents

Class file image Download
<?php
// Include the translator class
require_once('./translator.class.php');

$YourDomain 'http://www.karatag.de';
$lg 'de';

$gt = new translator();

$gt->setVar('url''http://'.$_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"]);
$gt->CurrentLanguage($lg);

$lp $gt->langPair();

$turls = array();
if (
sizeof($lp) >= 1) {
  foreach (
$lp as $value) {
    
$turls[] = $gt->setTranslateUrl($lg.'|'.$value);
  }
}


// Now you can use the result
echo '<h1>&Uuml;bersetze mir diese Seite bitte!</h1>';

if (
sizeof($turls) > 0) {

  echo 
'<br /><b>&Uuml;bersetzung:</b><br />';
  foreach (
$turls as $ti => $translation) {
    echo 
'<a href="'.$translation.'">'.$gt->languages($lp[$ti]).'</a><br />';
  }
} else {
  echo 
'No translation for this language.';
}

exit();
?>