This package allows you to:
- Generate translation files for the specified language,
- Generate new translation files for each language,
- Completing missing keys for translations
| Laravel | PHP | Package | Supported |
|---|---|---|---|
| From 11.x | 8.2+ | 4.x | ✅ |
| From 10.x | 8.1+ | 3.x | ❌ |
| 6.x to 10.x | 8.0+ | 2.x | ❌ |
composer require krzar/laravel-translation-generatorNote
Remember, this package supports Laravel Prompts. So you can skip commands arguments and just answer the questions.
Generate new translation files for es language.
php artisan make:translation esIf the file exists, it will be completed with the missing keys.
Files and keys will be copied based on the fallback locale specified in the app configuration.
You can change fallback locale.
If you have published any translations from other packages the command will ask you if you want to generate new language translations for them as well.
php artisan make:translation es --fallback=deYou can also overwrite all values if file currently exists.
php artisan make:translation es --overwriteAll values will be copied from fallback locale by default. If you want to clear every translation value you can use clear-values option.
php artisan make:translation es --clear-valuesThis will clear values only for new keys, to clear everything, combine two options.
php artisan make:translation es --clear-values --overwriteGenerate new php translation file for every language.
php artisan make:translation-file commonThis will generate new php file common.php in every language folder (except packages translations folders).