translate() public method

See the Pricing and FAQ pages for details. Find more information at Google Translate docs. Please note that while Google Translate supports authentication via service account and application default credentials like other Cloud Platform APIs, it also supports authentication via a public API access key. If you wish to authenticate using an API key, follow the before you begin instructions to learn how to generate a key. Example: use Google\Cloud\ServiceBuilder; $builder = new ServiceBuilder([ 'key' => 'YOUR_KEY' ]); $translate = $builder->translate();
public translate ( array $config = [] ) : TranslateClient
$config array [optional] { Configuration options. @type string $key A public API access key. @type string $target The target language to assign to the client. Defaults to `en` (English). @type callable $httpHandler A handler used to deliver Psr7 requests. Only valid for requests sent over REST. @type int $retries Number of retries for a failed request. **Defaults to** `3`. }
return Google\Cloud\Translate\TranslateClient
 public function testBuildsTranslateClient()
 {
     $config = ['key' => 'test_key'];
     $serviceBuilder = new ServiceBuilder($config);
     $this->assertInstanceOf(TranslateClient::class, $serviceBuilder->translate());
     $this->assertInstanceOf(TranslateClient::class, $serviceBuilder->translate($config));
 }