Download the PHP package stev/google-cloud-translate-bundle without Composer
On this page you can find all versions of the php package stev/google-cloud-translate-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download stev/google-cloud-translate-bundle
More information about stev/google-cloud-translate-bundle
Files in stev/google-cloud-translate-bundle
Package google-cloud-translate-bundle
Short Description Symfony 2 Bundle for Google Cloud Translate Basic API
License GPL-3.0
Informations about the package google-cloud-translate-bundle
GoogleCloudTranslationsBundle
A Symfony bundle to translate your application using Google cloud Translations API
Install
composer require stev/google-cloud-translations-bundle --dev
Initialize the bundle for dev env.
$bundles[] = new \Stev\GoogleCloudTranslateBundle\StevGoogleCloudTranslateBundle();
Configuration
Get your Google Cloud Key (https://cloud.google.com/translate/docs/quickstarts) and save it in your project in "app/data/key.json" or anywhere you want. Just make sure it's not a public folder.
Add the following configuration to config_dev.yml
stev_google_cloud_translate:
keyFilePath: '%kernel.root_dir%/../data/cp-google-cloud-key.json'
You must have JMS Translations installed (https://jmsyst.com/bundles/JMSTranslationBundle). If not already present in your composer it will be automatically installed. Here's a sample configuration
jms_translation:
locales: [en,fr,de]
configs:
app:
dirs: ["%kernel.root_dir%/../src/AppBundle"]
output_dir: "%kernel.root_dir%/Resources/AppBundle/translations"
ignored_domains: [routes]
excluded_names: ["*TestCase.php", "*Test.php"]
excluded_dirs: [cache, data, logs]
keep: true
output_format: xliff
Usage
Let's suppose your default language is English.
- Extract your translations using JMS command
php app/console translation:extract --config=app
- Translate the first set of messages in your default language (english). All default language translations must be provided by you/developers. You can use the web UI provided by JMS for that https://jmsyst.com/bundles/JMSTranslationBundle/master/webinterface.
- Use the following command to translate all messages from your default language to any other language supported by Google Translations:
php app/console stev:google_cloud_translate --config=app --sourceLocale=en --destinationLocale=fr
Now if you check your French translations files you should find all of your messages translated into French.
This bundle will not translate the following messages:
- The ones that are not NEW in the destination language.
- The ones that are NEW in the source language.
- Might break the messages with plural syntax or with placeholders. So those should be translated manually firstly or carefully checked afterwards for any break.
All versions of google-cloud-translate-bundle with dependencies
ext-json Version *
symfony/framework-bundle Version 2.7.*|2.8.*
symfony/symfony Version 2.7.*|2.8.*
google/cloud-translate Version ^1.12
jms/translation-bundle Version ^1.4