10.April 2026

This commit is contained in:
Kevin Adametz 2026-04-10 17:15:27 +02:00
parent a00c42e770
commit f58c709945
208 changed files with 19280 additions and 2914 deletions

View file

@ -0,0 +1,30 @@
<?php
namespace App\Services;
class LocaleGuard
{
/**
* @return array<int, string>
*/
public static function supportedLocaleCodes(): array
{
return array_keys(config('localization.supportedLocales'));
}
public static function isSupported(string $locale): bool
{
return in_array(strtolower($locale), self::supportedLocaleCodes(), true);
}
public static function normalize(?string $locale): ?string
{
if ($locale === null || $locale === '') {
return null;
}
$lower = strtolower($locale);
return self::isSupported($lower) ? $lower : null;
}
}