Download the PHP package naimkhalifa/laravel-google-cloud-translation without Composer
On this page you can find all versions of the php package naimkhalifa/laravel-google-cloud-translation. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download naimkhalifa/laravel-google-cloud-translation
More information about naimkhalifa/laravel-google-cloud-translation
Files in naimkhalifa/laravel-google-cloud-translation
Package laravel-google-cloud-translation
Short Description A package to easily integrate Google Cloud Translation API with Laravel
License MIT
Homepage https://github.com/naimkhalifa/laravel-google-cloud-translation
Informations about the package laravel-google-cloud-translation
A package to easily integrate Google Cloud Translation API with Laravel
Installation
You can install the package via composer:
You can publish the config file with:
This is the contents of the published config file:
Usage
GoogleCloudTranslation::translate(string \$text, array $options)
Use this method if you want to translate a single text string.
GoogleCloudTranslation::translateBatch(array \$input, array $options)
Use this method if you want to translate multiple strings at once.
Commands
Translate language files
This Artisan command allows you to translate strings in a language file using Google Cloud Translation.
The format of the file you want to translate should conform to what you would typically find under Laravel /lang
folder.
Options
--source
: Specify the source language for translation. (Required)
--target
: Specify the target language for translation. (Required)
--file
: Specify the path to the language file you want to translate. (Required)
--dryrun
: Enable dry run mode, which will display translations without saving them to a file. (Optional, enabled by default)
Example
This is when you're running the command with --dryrun option enabled (by default).
This command will translate all the strings in the messages.php language file from English (en) to French (fr) and display the translations on the terminal.
You then have to confirm with prompt for the translations to be saved to destination file (in this example, that would be resources/lang/fr/messages.php
).
Be careful that this will override any existing file that lives at that path! Basically replacing it.
If you want to bypass confirmation and directly write to destination, you can disable dryrun mode (--dryrun=false
)
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Naïm Khalifa
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-google-cloud-translation with dependencies
google/cloud-translate Version ^1.15
illuminate/contracts Version ^10.0
spatie/laravel-package-tools Version ^1.14.0