Google Translation Client
This is a minimalistic API client for Google Translation API, (*1)
Installation
Installation is conveniently provided via Composer., (*2)
To get started, install composer in your project:, (*3)
$ curl -s https://getcomposer.org/installer | php
Next, add a composer.json file containing the following:, (*4)
}
"require": {
"google/translation-client": "dev-master"
}
}
Finall, install!, (*5)
$ php composer.phar install
Usage
Using the Google Translation client is easy:, (*6)
``` php
<?php, (*7)
require_once '../src/Client.php';, (*8)
try {
$client = new Goolge_Translate('YOUR API KEY');
$client->setSource('en')
->setTarget('gl')
->setText('If wishes were fishes, we\'d all cast nets')
->translate();
} catch (Exception $e) {
echo $e->getMessage();
}, (*9)
```, (*10)