PHP code example of rpwebdevelopment / laravel-translate
1. Go to this page and download the library: Download rpwebdevelopment/laravel-translate library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
rpwebdevelopment / laravel-translate example snippets
return [
'reader' => 'php',
'default_source' => 'en_GB',
'target_locales' => [],
'lang_directory' => base_path('resources/lang'),
'provider' => 'google',
'providers' => [
'google' => [
'package' => GoogleTranslate::class,
],
'deepl' => [
'package' => DeeplTranslate::class,
'token' => env('DEEPL_AUTH_TOKEN', null),
'model_type' => 'prefer_quality_optimized',
'formality' => 'default',
],
'aws' => [
'package' => AwsTranslate::class,
'credentials' => [
'key' => env('AWS_ACCESS_KEY_ID', null),
'secret' => env('AWS_SECRET_ACCESS_KEY', null),
],
'settings' => [
"Formality" => "FORMAL"
],
"region" => env('AWS_DEFAULT_REGION', "us-east-1"),
"version" => "latest",
],
],
'readers' => [
'php' => PhpReader::class,
'json' => JsonReader::class,
],
'writers' => [
'php' => PhpWriter::class,
'json' => JsonWriter::class,
],
];
php artisan laravel-translate {target} {--source=?} {--file=?} {--missing-only}
php artisan laravel-translate:bulk {--source=?} {--file=?} {--missing-only}
php artisan laravel-translate:bulk {--verbose}
php artisan laravel-translate fr_FR
php artisan laravel-translate fr_FR --source=en_GB
php artisan laravel-translate fr_FR --source=en_GB --file=auth
php artisan laravel-translate de_DE --source=en_GB
bash
php artisan vendor:publish --tag="translate-config"
bash
#! /bin/bash
missing="$( php artisan laravel-translate:missing )"
if [ "$missing" = "translations missing" ];then
echo "Translations Missing";
exit 0
fi
bash
resources
|----lang
|----en_GB
|----auth.php
|----global.php
bash
resources
|----lang
|----en_GB
| |----auth.php
| |----global.php
|----fr_FR
|----auth.php
|----global.php
bash
resources
|----lang
|----en_GB.php
|----fr_FR.php
bash
resources
|----lang
|----en_GB.php
|----fr_FR.php
|----de_DE.php