bound('translator')) { $appLocale = app()->getLocale(); } if (app()->bound('config')) { $fallbackLocale = app('config')->get('app.fallback_locale'); } } catch (\Throwable $e) { } } $candidates = array_merge( $locales, [static::getLocale()], [$appLocale], [$fallbackLocale], ['en'] ); $normalized = []; foreach ($candidates as $locale) { if (empty($locale)) { continue; } $normalized[] = $locale; $language = static::getLanguageFromLocale($locale); if ($language !== $locale) { $normalized[] = $language; } } return array_values(array_unique($normalized)); } }