gabrieljmj / translator-bundle
Bundle for Gabrieljmj\Translator
v1.0
2015-06-16 16:59 UTC
Requires
- gabrieljmj/translator: dev-master
This package is auto-updated.
Last update: 2025-01-16 04:48:37 UTC
README
Bundle for use Gabrieljmj\Translator with Symfony application.
Usage
Installing
composer require gabrieljmj/translator-bundle
Add this bundle on kernel:
// app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Gabrieljmj\TranslatorBundle\TranslatorBundle() ); }
Configuring
translator: google_translate: api_key: [YOUR-API-KEY] yandex_translate: api_key: [YOUR-API-KEY]
Using
The translators are registred as services, so you can get on a controller:
$translator = $this->get('gabrieljmj.translator.google'); // or gabrieljmj.translator.yandex $text = $translator->translate('en', 'es', 'Fucking bastards!');