Download the PHP package eko/googletranslatebundle without Composer
On this page you can find all versions of the php package eko/googletranslatebundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package googletranslatebundle
GoogleTranslateBundle
Features
- Detect language used for a string
- Translate a string from a source language to a target one
- Translate a string into a target language by using language auto-detection (consume 1 more API call)
- Retrieve all languages available on API and obtain language names in a given language
- Profile detector / translate / languages list API calls in the Symfony profiler!
Installation
Add the bundle to your composer.json
file:
Add this to app/AppKernel.php
Configuration
Edit app/config.yml
The following configuration lines are required:
Usages
Detect a string language
Retrieve the detector service and call the detect()
method:
Translate a string
Retrieve the translator service and call the translate()
method:
Translate a string from unknown language (use detector)
Retrieve the translator service and call the translate()
method without the source (third) parameter:
Translate multiple strings
Retrieve the translator service and call the translate()
method with an array of your strings:
Note that you can also use an "economic mode" to translate multiple strings in a single request which is better for your application performances.
Your translations will be concatenated in one single Google request. To use it, simply add true
to the last argument:
Obtain all languages codes available
Retrieve the languages service and call the get()
method without any argument:
Obtain all languages codes available with their names translated
Retrieve the languages service and call the get()
method with a target language argument:
Notice: this will consume a detector API call.
All versions of googletranslatebundle with dependencies
symfony/framework-bundle Version ^2.0|^3.0
guzzlehttp/guzzle Version ~5.0