php-translation / loco-adapter
Adapter for loco.
Installs: 1 580 799
Dependents: 2
Suggesters: 0
Security: 0
Stars: 25
Watchers: 6
Forks: 37
Open Issues: 8
Requires
- php: ^7.2 || ^8.0
- friendsofapi/localise.biz: ^1.0
- php-translation/symfony-storage: ^2.1
- symfony/translation: ^4.4.20 || ^5.2.5 || ^6.0
- symfony/yaml: ^4.4.20 || ^5.2.5 || ^6.0
Requires (Dev)
- nyholm/psr7: ^1.2
- nyholm/symfony-bundle-test: ^1.6.1, <1.8
- php-http/curl-client: ^2.0
- php-http/httplug-bundle: ^1.16
- php-http/message: ^1.11
- phpunit/phpunit: ^8.5
- symfony/framework-bundle: ^4.4.20 || ^5.2.5 || ^6.0
README
This is an PHP-translation adapter for Loco (Localise.biz).
Install
composer require php-translation/loco-adapter
Symfony bundle
If you want to use the Symfony bundle you may activate it in kernel:
// app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Translation\PlatformAdapter\Loco\Bridge\Symfony\TranslationAdapterLocoBundle(), ); }
If you have one Loco project per domain you may configure the bundle like this:
# /app/config/config.yml translation_adapter_loco: index_parameter: 'id' # 'text' or 'name'. Leave blank for "auto" See https://localise.biz/api/docs/export/exportlocale projects: messages: api_key: 'foobar' navigation: api_key: 'bazbar' status: '!untranslated,!rejected' # if you want filter on loco translations statuses. By default only 'translated' translations are pulled.
If you just doing one project and have tags for all your translation domains you may use this configuration:
# /app/config/config.yml translation_adapter_loco: index_parameter: 'id' # 'text' or 'name'. Leave blank for "auto" See https://localise.biz/api/docs/export/exportlocale projects: acme: api_key: 'foobar' domains: ['messages', 'navigation']
This will produce a service named php_translation.adapter.loco
that could be used in the configuration for
the Translation Bundle.
If you need to override the HTTPlug client:
# /app/config/config.yml translation_adapter_loco: httplug_client: httplug.client.loco # You can even customize the message and uri factory # httplug_message_factory: null # httplug_uri_factory: null httplug: clients: loco: factory: 'httplug.factory.guzzle6' plugins: - httplug.plugin.content_length - httplug.plugin.logger config: timeout: 2
By default it will use the discovery feature of HTTPlug.
Documentation
Read our documentation at http://php-translation.readthedocs.io.
Contribute
Do you want to make a change? Pull requests are welcome.