1. Go to this page and download the library: Download fei/translate-package 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-package example snippets
use ObjectivePHP\Application\AbstractApplication;
use Fei\Service\Translate\Package\TranslatePackage;
class Application extends AbstractApplication
{
public function init()
{
// Define some application steps
$this->addSteps('bootstrap', 'init', 'auth', 'route', 'rendering');
// Initializations...
// Plugging the Translate Package in the bootstrap step
$this->getStep('bootstrap')
->plug(TranslatePackage::class);
// Another initializations...
}
}
use Fei\Service\Translate\Package\Config\TranslateParam;
use Fei\ApiClient\Transport\BasicTransport;
return [
new TranslateParam('base_url', 'http://translate.api/'), // Translate API URL and port
new TranslateParam('transport', new BasicTransport()), // Transport type
new TranslateParam('translate_directory', '/app/translate/'), // Directory to store the translations
new TranslateParam('translate_config', [
'lock_file' => '/app/translate/.translations.lock',
'data_path' => '/app/translate/data',
'translations_path' => '/app/translate/translations',
'localTranslationsFile' => dirname(__DIR__) . '/localTranslations.php',
'skipSubscription' => false,
'servers' => [
'http://translate.api/' => [
'namespaces' => ['/mynamespace'],
'host' => 'other-host'
]
],
'url' => 'http://translate.domain.dev/handleRequest.php'
]),// Translate client config (Cf. Translate Client documentation)
new TranslateParam('translate_namespace', '/mynamespace'), // Namespace defined in translate_config where to search the translations
new TranslateParam('translate_lang', 'en_GB') // Language defined in which we want the translations
];
use Fei\Service\Translate\Package\Config\TranslateParam;
return [
new TranslateParam('translate_config', [
'localTranslationsFile' => dirname(__DIR__) . '/localTranslations.php',
'skipSubscription' => true,
]),
];
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.