diff --git a/app/Http/Middleware/VendorLocale.php b/app/Http/Middleware/VendorLocale.php index 17ae99c62e3f..6da86375ad0a 100644 --- a/app/Http/Middleware/VendorLocale.php +++ b/app/Http/Middleware/VendorLocale.php @@ -17,6 +17,48 @@ use Illuminate\Support\Facades\App; class VendorLocale { + private array $locales = [ + 'en', + 'it', + 'de', + 'fr', + 'pt_BR', + 'nl', + 'es', + 'nb_NO', + 'da', + 'ja', + 'sv', + 'es_ES', + 'fr_CA', + 'lt', + 'pl', + 'cs', + 'hr', + 'sq', + 'el', + 'en_GB', + 'pt_PT', + 'sl', + 'fi', + 'ro', + 'tr_TR', + 'th', + 'mk_MK', + 'zh_TW', + 'ru_RU', + 'ar', + 'fa', + 'lv_LV', + 'sr', + 'sk', + 'et', + 'bg', + 'he', + 'km_KH', + 'hu', + 'fr_CH', + ]; /** * Handle an incoming request. * @@ -32,7 +74,7 @@ class VendorLocale } /*LOCALE SET */ - if ($request->has('lang') && is_string($request->input('lang'))) { + if ($request->has('lang') && in_array($request->input('lang','en'), $this->locales) ) { $locale = $request->input('lang'); App::setLocale($locale); } elseif (auth()->guard('vendor')->user()) {