This will allow localization files to be automatically updated after dependency updates, rather than manually calling the php artisan lang:update console command.
Alternative
If you do not want to install all the dependencies for some reason, you can install each one separately:
Out of the box, Laravel doesn't allow fallback translations for JSON keys. For example, when you call __('Remember Me'), you get Remember Me instead of Se souvenir de moi for French fallback language.
To install, run the console command:
composer require laravel-lang/json-fallback
After this, you need to add a link to the service provider in the providers section of the config/app.php settings file:
<?php
use Illuminate\Support\ServiceProvider;
use Illuminate\Translation\TranslationServiceProvider as BaseTranslationServiceProvider;
use LaravelLang\JsonFallback\TranslationServiceProvider as JsonTranslationServiceProvider;
return [
'providers' => ServiceProvider::defaultProviders()->merge([
// your service providers
])->replace([
BaseTranslationServiceProvider::class => JsonTranslationServiceProvider::class,
])->toArray(),
];
Now JSON keys will correctly output the value based on the selected localization.
Lumen Framework
As a result of this message from the Laravel team, we do not officially support the Lumen Framework in our projects.