Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gabrieljmj/translatorbundle
Bundle for Gabrieljmj\Translator
https://github.com/gabrieljmj/translatorbundle
Last synced: about 2 months ago
JSON representation
Bundle for Gabrieljmj\Translator
- Host: GitHub
- URL: https://github.com/gabrieljmj/translatorbundle
- Owner: gabrieljmj
- License: other
- Created: 2015-05-26T18:32:08.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-06-16T16:59:35.000Z (over 9 years ago)
- Last Synced: 2024-05-07T01:02:41.492Z (8 months ago)
- Language: PHP
- Size: 129 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
Gabrieljmj\TranslatorBundle
===========================
Bundle for use [Gabrieljmj\Translator](http://github.com/gabrieljmj/translator) with Symfony application.## Usage
### Installing
[Composer](https://getcomposer.org):
```console
composer require gabrieljmj/translator-bundle
```Add this bundle on kernel:
```php
// app/AppKernel.phppublic function registerBundles()
{
$bundles = array(
// ...
new Gabrieljmj\TranslatorBundle\TranslatorBundle()
);
}
```### Configuring
```yaml
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:
```php
$translator = $this->get('gabrieljmj.translator.google'); // or gabrieljmj.translator.yandex
$text = $translator->translate('en', 'es', 'Fucking bastards!');
```