This commit is contained in:
deploy-bot committed 2026-12-04 14:33:04 +00:00
commit bf5c31169a
221 files changed
+16292

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
<?php
namespace IriksIT\Manager\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use IriksIT\Manager\Models\UserSetting;
use Symfony\Component\HttpFoundation\Response;
/**
* The language an account chose applies to everything the manager says to it (menu, messages, the shell), inside the
* manager's routes only: the site's own pages keep the language of the site. Nothing chosen: the language of the app.
*/
class SetLocale
{
public function handle(Request $request, Closure $next): Response
{
$chosen = UserSetting::value($request->user(), 'locale');
if (in_array($chosen, UserSetting::LOCALES, true)) {
app()->setLocale($chosen);
}
return $next($request);
}
}