Downloads
Stars
Version
This package translates your Laravel localization files automatically using a third party service. Currently only supports DeepL.
This package only works with 'Short Keys' approach
You can install the package via composer:
composer require --dev javidalpe/laravel-localization-automation
If you're on Laravel 5.4 or earlier, you'll need to add the following to your config/app.php:
'providers' => [
...
Javidalpe\LaravelLocalizationAutomation\LaravelLocalizationAutomationServiceProvider::class,
];
This command translates all your files in /lang/{from}/
directory and create the new ones in /lang/{to}/
directory.
php artisan localization:translate {from} {to} {--provider=deepl}
Example using default provider:
php artisan localization:translate es fr
Example using custom provider:
php artisan localization:translate es fr --provider=deepl
The command will fail on:
\\Wrong
'welcome.greetings' => '<strong>Hey!</strong>',
\\Good
'welcome.greetings' => 'Hey!',
\\Wrong
'welcome.greetings' => 'Hey {{name}}!',
\\Good
'welcome.greetings' => 'Hey!',
DeepL(y) supports these languages:
Code | Language |
---|---|
DE | German |
EN | English |
FR | French |
ES | Spanish |
IT | Italian |
NL | Dutch |
PL | Polish |
DeepL says they will add more languages in the future, such as Chinese and Russian.
/lang/{from}/
directory./lang/{to}/
directory./src/TranslationServices
. Implements TranslationServiceStrategy
.TranslationServiceStrategyFactory
.The MIT License (MIT). Please see License File for more information.