sabrihamda/google-translator-bundle

Symfony Translator using google

dev-master / 1.0.x-dev 2019-05-03 08:35 UTC

This package is auto-updated.

Last update: 2024-04-29 04:03:22 UTC


README

5000 words maximum

This bundle will allow you to translate your symfony application instantly and with a single command line in all languages ​​supported by google.

Installing / Getting started

To use this bundle you would need two symfony4 components.
Twig & Translations.
Cause the bundle will looking for {{'the string to translate'|trans}} in the /Templates directory by fetching all files with the .twig extension.

Installation with composer

Using symfony/flex.

1 - Install Twig

php composer require twig

2 - Install Translations

php composer require translations

Finaly - Install Google Translator Bundle

php composer require sabrihamda/google-translator-bundle

Initial Configuration

Templates

To safly start with this bundle, be sure that all the words to be translated are passed to the Translations component like this:
{{ 'string to translate'|trans }}

Example:

Config

Go to ./config/packages/translation.yaml and add your target languages.

Example:

That's it :)

Run the command

Go to your command line and run the command:

php bin/console google:translate


All the messages files will be generated in the ./translation directory.

Licensing

The code in this project is licensed under MIT license.

Copyright (c) 2019 Sabri Hamda

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.