From afdb121464bee5672272d151acdc70d0378740f6 Mon Sep 17 00:00:00 2001 From: Muhammad Amin Ghorbani Date: Sun, 1 Nov 2026 11:42:00 +0330 Subject: [PATCH] i18n: add internationalization support to shared components and tour features --- src/components/shared/CountryDialSelect.tsx | 36 +- src/components/shared/FilterBar.tsx | 12 +- src/components/shared/FilterSelect.tsx | 9 +- src/components/shared/MultiFilterSelect.tsx | 16 +- src/components/shared/SortDropdown.tsx | 15 +- src/components/shared/ViewToggle.tsx | 17 +- .../components/ReceiptLightboxDialog.tsx | 53 +- src/features/dashboard/DashboardHome.tsx | 40 +- src/features/services/ServicesPage.tsx | 8 +- .../services/components/BlogsServiceView.tsx | 26 +- .../services/components/StoreServiceView.tsx | 4 +- .../components/SupportServiceView.tsx | 12 +- .../components/TestimonialsSettingsTab.tsx | 4 +- .../tours/components/CreateTourDialog.tsx | 334 +++- .../tours/components/TourDetailDialog.tsx | 193 ++- .../tours/components/TourDetailSheet.tsx | 65 +- .../tours/components/TourDetailShimmer.tsx | 2 +- .../TourHotelsAndTransportEditors.tsx | 1347 +++++++++++++++++ src/features/tours/utils/tour-meta-builder.ts | 906 +++++++++++ .../users/components/UserToursTab.tsx | 6 +- src/locales/ar.json | 130 +- src/locales/en.json | 110 +- src/locales/fa.json | 126 +- 23 files changed, 3267 insertions(+), 204 deletions(-) create mode 100644 src/features/tours/components/TourHotelsAndTransportEditors.tsx create mode 100644 src/features/tours/utils/tour-meta-builder.ts 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 })} >