Ok, here is the manual on how to use Google Translator with the CyberSEO plugin.
1) Syndicate the feed your are going to pull posts from.
2) In the feed options menu post the following code into the "PHP Code <?php .. ?>" box:
Code:
// Set source language, e.g. English
$s = 'en';
// Set destination language, e.g. German
$d = 'de';
if ($post ['post_content'] == '') {
$post ['post_content'] = $post ['post_excerpt'];
}
$ch = curl_init ();
curl_setopt ( $ch, CURLOPT_URL, 'http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=' . urlencode ( $post ['post_content'] ) . '&langpair=' . urlencode ( $s . '|' . $d ) );
curl_setopt ( $ch, CURLOPT_REFERER, 'http://www.yoursite.com/translate.php' );
curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 );
$json = json_decode ( curl_exec ( $ch ), true );
$post ['post_content'] = $json ['responseData'] ['translatedText'];
3) Save the settings and pull the feed.
Done!
The code above has two variables: $s and $d. Use them to set source and destination language for your feed. For example, if you want to translate the Danish feed to Spanish, use the following values:
$s = 'da';
$d = 'es';
Now you can use the Google translator with CyberSEO.
That's very easy. Isn't it?
