This bundle include service for translate with Google Translate and command which translate messages in your Bundles
{"require": {"exercise/google-translate-bundle": "*"}}Enable the bundle in the your kernel:
// app/AppKernel.phppublicfunctionregisterBundles()
{
$bundles = array(
// ...newExercise\GoogleTranslateBundle\ExerciseGoogleTranslateBundle(),
);
}Enter your private api key in configuration
# app/config/config.ymlexercise_google_translate:
api_key: your_api_keyYou can it use as a service
// Acme/DemoBundle/Controller/WelcomeController.phppublicfunctionindexAction() {
...$translator = $this->get('exercise_google_translate.translator');
$translatedString = $translator->translate('Hello World!', 'en', 'fr');
// Bonjour tout le monde!returnnewResponse($translatedString);
}or you can use console command to translate messages
app/console gtranslate:translate en fr AcmeDemoBundleGoogleTranslateBundle uses GitHub issues. If you have found bug, please create an issue.
This bundle is under the MIT license. See the complete license in LICENSE.md
