use Livewire\Livewire;
use JeffersonGoncalves\LocaleCookie\Middleware\SetLocale;
// In a service provider's boot() method
Livewire::addPersistentMiddleware([
SetLocale::class,
]);
'switch' => [
'enabled' => true,
'path' => 'locale/{locale}',
'name' => 'locale.switch',
'lifetime' => 60 * 24 * 365, // cookie lifetime in minutes
'middleware' => ['web'], // attaches the queued cookie; the locale cookie is excluded from encryption
],
use JeffersonGoncalves\LocaleCookie\LocaleCookie;
LocaleCookie::short('pt_BR'); // 'pt'
LocaleCookie::short('pt-BR'); // 'pt'
LocaleCookie::short('EN'); // 'en'
LocaleCookie::short(); // current app locale, shortened
LocaleCookie::short(''); // 'en' (fallback when there is no usable prefix)