= 65 && $char <= 90) { // A-Z $flag .= mb_chr(0x1F1E6 + ($char - 65)); } } return $flag ?: '🏳️'; } /** * ISO alpha-2 국가 코드를 현재 로케일에 맞는 국가명으로 변환합니다. * * config/countries.php의 localized_names에서 국가명을 조회합니다. * 현재 로케일에 국가명이 없으면 폴백 로케일을 사용하고, * 그마저도 없으면 원본 국가 코드를 반환합니다. * * @param string $countryCode ISO alpha-2 국가 코드 * @return string 현재 로케일에 맞는 국가명 */ protected function getCountryName(string $countryCode): string { $countryCode = strtoupper($countryCode); $locale = app()->getLocale(); $fallbackLocale = config('app.fallback_locale', 'en'); $countryNames = config('countries.localized_names', []); return $countryNames[$locale][$countryCode] ?? $countryNames[$fallbackLocale][$countryCode] ?? $countryCode; } }