PHP code example of fei / translate-client

1. Go to this page and download the library: Download fei/translate-client library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

fei / translate-client example snippets


 
$translate = new Translate([Translate::OPTION_BASEURL => 'http://translate.dev']);
$translate->setTransport(new BasicTransport());


return [
    'lock_file' => dirname(__DIR__) . '/.translations.lock',
    'data_path' => dirname(__DIR__) . '/data',
    'translations_path' => dirname(__DIR__) . '/translations',
    'servers' => [
        'http://10.5.0.1:8010' => [
            'namespaces' => ['/a/b/c/d']
        ]
    ],
    'url' => 'http://10.6.0.1:8040/examples/handleRequest.php/update'
];



use Fei\Service\Translate\Client\ Translate;
use Fei\ApiClient\Transport\BasicTransport;
use Fei\ApiClient\Transport\BeanstalkProxyTransport;
use Pheanstalk\Pheanstalk;

$translate = new Translate([Translate::OPTION_BASEURL => 'https://translate.api']); // Put your translate API base URL here
$translate->setTransport(new BasicTransport());

$proxy = new BeanstalkProxyTransport();
$proxy->setPheanstalk(new Pheanstalk('127.0.0.1'));

$translate->setAsyncTransport($proxy);

// Use the translate client methods...