diff --git a/src/components/shared/CountryDialSelect.tsx b/src/components/shared/CountryDialSelect.tsx index 3b9a640..b772ebe 100644 --- a/src/components/shared/CountryDialSelect.tsx +++ b/src/components/shared/CountryDialSelect.tsx @@ -3,6 +3,7 @@ import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover import { Input } from '@/components/ui/input' import { Ic } from '@/icons' import { cn } from '@/lib/utils' +import { useTranslation } from '@/i18n' import { ALL_COUNTRIES, POPULAR_COUNTRIES, @@ -26,6 +27,7 @@ export function CountryDialSelect({ className, buttonClassName, }: CountryDialSelectProps) { + const { t, language } = useTranslation() const [open, setOpen] = useState(false) const [query, setQuery] = useState('') const searchInputRef = useRef(null) @@ -35,6 +37,13 @@ export function CountryDialSelect({ return findCountryByDialCode(value) || ALL_COUNTRIES[0] }, [value]) + const selectedCountryName = useMemo(() => { + if (!selectedCountry) return '' + if (language === 'ar') return selectedCountry.nameAr || selectedCountry.nameFa + if (language === 'en') return selectedCountry.nameEn + return selectedCountry.nameFa + }, [selectedCountry, language]) + // Auto-focus search input on popover open useEffect(() => { if (open) { @@ -100,7 +109,7 @@ export function CountryDialSelect({ buttonClassName, className )} - title={`انتخاب کشور (${selectedCountry?.nameFa || ''})`} + title={t('common.selectCountryTitle', { name: selectedCountryName })} >