From dab5b62fb755ff746102f7361b0218fea100cabf Mon Sep 17 00:00:00 2001 From: Rahaf Date: Wed, 1 Jul 2026 15:43:58 +0300 Subject: [PATCH] Added translation to all site with edit style --- app/ClientLayout.js | 140 +- app/account-verification/page.js | 76 +- app/auth/choose-role/page.js | 50 +- app/blocked/page.js | 40 +- app/booked-properties/page.js | 54 +- app/change-password/page.js | 34 +- app/components/BottomNav.js | 14 +- app/components/FloatingSidebar.js | 10 +- app/components/home/HeroSearch.js | 70 +- app/components/ratings/CustomerRatingForm.js | 30 +- app/enums/BookingStatus.js | 11 +- app/enums/BuildingType.js | 15 +- app/enums/CancellationReason.js | 8 +- app/enums/City.js | 18 +- app/enums/CommissionType.js | 8 +- app/enums/Currency.js | 9 +- app/enums/CustomerType.js | 7 +- app/enums/IdentityType.js | 7 +- app/enums/OwnerType.js | 7 +- app/enums/PropertyService.js | 18 +- app/enums/PropertyStatus.js | 8 +- app/enums/PropertyTerm.js | 8 +- app/enums/RentPropertyCondition.js | 7 +- app/enums/RentPropertyType.js | 8 +- app/enums/RentType.js | 7 +- app/enums/SalePropertiesStatus.js | 7 +- app/enums/TransactionType.js | 7 +- app/enums/UserRole.js | 9 +- app/faq/page.js | 56 +- app/favorites/page.js | 22 +- app/forgot-password/page.js | 44 +- app/i18n/config.js | 2866 +++++++++++++++++- app/login/page.js | 86 +- app/my-rates/page.js | 35 +- app/notifications/page.js | 20 +- app/onboarding/page.js | 54 +- app/owner/account-book/page.js | 53 +- app/owner/bookings/page.js | 188 +- app/owner/calendar/page.js | 127 +- app/owner/profits/page.js | 88 +- app/owner/properties/add/page.js | 389 +-- app/owner/properties/page.js | 515 ++-- app/owner/reservations/page.js | 145 +- app/page.js | 315 +- app/payments/page.js | 301 +- app/profile/page.js | 46 +- app/properties/page.js | 174 +- app/property/[id]/PropertyDetail.js | 355 +-- app/property/[id]/page.js | 2 +- app/register/agent/page.js | 230 +- app/register/owner/page.js | 727 +---- app/register/tenant/page.js | 124 +- app/reports/page.js | 92 +- app/reservations/page.js | 204 +- app/settings/page.js | 334 +- app/support/page.js | 47 +- 56 files changed, 5136 insertions(+), 3190 deletions(-) diff --git a/app/ClientLayout.js b/app/ClientLayout.js index d33bf30..446cecc 100644 --- a/app/ClientLayout.js +++ b/app/ClientLayout.js @@ -157,7 +157,7 @@ export default function ClientLayout({ children }) {
-

جاري التحميل...

+

{t("loading")}

); @@ -202,7 +202,7 @@ export default function ClientLayout({ children }) { - تحميل التطبيق + {t("downloadApp")}
@@ -215,8 +215,8 @@ export default function ClientLayout({ children }) {
-

Android

-

تحميل APK

+

{t("android")}

+

{t("downloadAPK")}

@@ -226,16 +226,16 @@ export default function ClientLayout({ children }) {
-

iOS

-

قريباً

+

{t("ios")}

+

{t("comingSoon")}

- الرئيسية - عقاراتنا + {t("home")} + {t("ourProperties")} {isOwner && ( @@ -243,25 +243,19 @@ export default function ClientLayout({ children }) { - عقاراتي + {t("myProperties")} - الحجوزات + {t("reservations")} - {/* - - - التقويم - - */} - الأرباح + {t("profits")} @@ -272,13 +266,13 @@ export default function ClientLayout({ children }) { - تسجيل الدخول + {t("login")} - إنشاء حساب + {t("createAccount")} @@ -322,14 +316,14 @@ export default function ClientLayout({ children }) {

- {user?.name || "مستخدم"} + {user?.name || t("userLabel")}

{user?.email || ""}

-

- {UserRoleLabels[user?.role] || 'زائر'} -

+

+ {t(UserRoleLabels[user?.role] ? `userRole.${user?.role.toLowerCase()}` : 'visitor')} +

@@ -342,9 +336,9 @@ export default function ClientLayout({ children }) { >
-

الملف الشخصي

+

{t("profile")}

- عرض وتعديل معلوماتك + {t("viewAndEditInfo")}

@@ -356,9 +350,9 @@ export default function ClientLayout({ children }) { >
-

المفضلة

+

{t("favorites")}

- العقارات المحفوظة + {t("savedProperties")}

@@ -370,9 +364,9 @@ export default function ClientLayout({ children }) { >
-

عقاراتي المحجوزة

+

{t("myBookedProperties")}

- عرض وتقييم العقارات المحجوزة + {t("viewAndRateBooked")}

@@ -384,9 +378,9 @@ export default function ClientLayout({ children }) { >
-

تقييماتي

+

{t("myRatings")}

- التقييمات التي تلقيتها + {t("ratingsReceived")}

@@ -398,9 +392,9 @@ export default function ClientLayout({ children }) { >
-

الإعدادات

+

{t("settings")}

- إعدادات الحساب والأمان + {t("accountAndSecurity")}

@@ -416,9 +410,9 @@ export default function ClientLayout({ children }) { >
-

عقاراتي

+

{t("myProperties")}

- إدارة عقاراتك + {t("manageYourProperties")}

@@ -430,9 +424,9 @@ export default function ClientLayout({ children }) { >
-

إضافة عقار

+

{t("addProperty")}

- أضف عقاراً جديداً + {t("addNewProperty")}

@@ -444,9 +438,9 @@ export default function ClientLayout({ children }) { >
-

الحجوزات

+

{t("reservations")}

- إدارة حجوزاتك + {t("manageReservations")}

@@ -458,9 +452,9 @@ export default function ClientLayout({ children }) { >
-

التقويم

+

{t("calendar")}

- جدول توفر العقارات + {t("propertyAvailability")}

@@ -472,9 +466,9 @@ export default function ClientLayout({ children }) { >
-

الأرباح

+

{t("profits")}

- إحصائيات وأرباح + {t("statisticsAndProfits")}

@@ -486,9 +480,9 @@ export default function ClientLayout({ children }) { >
-

دفتر الحسابات

+

{t("accountBook")}

- سجل المعاملات المالية + {t("financialRecords")}

@@ -506,9 +500,9 @@ export default function ClientLayout({ children }) { >
-

حجوزاتي

+

{t("myBookings")}

- عرض حجوزاتك + {t("viewBookings")}

@@ -520,9 +514,9 @@ export default function ClientLayout({ children }) { >
-

عقاراتي المحجوزة

+

{t("myBookedProperties")}

- عرض وتقييم العقارات المحجوزة + {t("viewAndRateBooked")}

@@ -534,9 +528,9 @@ export default function ClientLayout({ children }) { >
-

تقييماتي

+

{t("myRatings")}

- التقييمات التي تلقيتها + {t("ratingsReceived")}

@@ -548,9 +542,9 @@ export default function ClientLayout({ children }) { >
-

البلاغات

+

{t("reports")}

- تقديم ومتابعة البلاغات + {t("submitAndTrackReports")}

@@ -565,9 +559,9 @@ export default function ClientLayout({ children }) { >
-

تسجيل الخروج

+

{t("logout")}

- إنهاء الجلسة الحالية + {t("endSession")}

@@ -642,19 +636,19 @@ export default function ClientLayout({ children }) { {/* Download App - Mobile */}
-

تحميل التطبيق

+

{t("downloadApp")}

- Android - تحميل APK + {t("android")} - {t("downloadAPK")}
- iOS - قريباً + {t("ios")} - {t("comingSoon")}
@@ -665,7 +659,7 @@ export default function ClientLayout({ children }) { > - عقاراتي + {t("myProperties")} - الحجوزات + {t("reservations")} - التقويم + {t("calendar")} - الأرباح + {t("profits")} @@ -704,7 +698,7 @@ export default function ClientLayout({ children }) { - تسجيل الدخول + {t("login")} - إنشاء حساب + {t("createAccount")} @@ -740,18 +734,18 @@ export default function ClientLayout({ children }) {
- {!isAuthPage && ( + {!isAuthPage && isAuthenticated && (
- {!isAuthenticated ? 'زائر' : isOwner ? 'مالك' : 'عميل'} + {!isAuthenticated ? t('visitor') : isOwner ? t('owner') : t('customer')}
- المفضلة + {t("favorites")}
@@ -762,19 +756,25 @@ export default function ClientLayout({ children }) {
)}
- الإشعارات + {t("notifications")}
- الإعدادات + {t("settings")}
+
diff --git a/app/account-verification/page.js b/app/account-verification/page.js index 52b1674..16cd020 100644 --- a/app/account-verification/page.js +++ b/app/account-verification/page.js @@ -4,6 +4,7 @@ import { useState, useEffect } from 'react'; import { useRouter } from 'next/navigation'; import Link from 'next/link'; import { motion } from 'framer-motion'; +import { useTranslation } from 'react-i18next'; import { Mail, Phone, @@ -21,6 +22,7 @@ import { sendEmailOTP, sendPhoneOTP, verifyEmail, verifyPhone } from '../utils/a export default function AccountVerificationPage() { const router = useRouter(); + const { t } = useTranslation(); const [user, setUser] = useState(null); const [isLoading, setIsLoading] = useState(true); @@ -49,10 +51,10 @@ export default function AccountVerificationPage() { setSendingEmailOTP(true); try { await sendEmailOTP(); - toast.success('تم إرسال رمز التحقق إلى بريدك الإلكتروني'); + toast.success(t('accountVerification.emailOtpSent')); setShowEmailInput(true); } catch (err) { - toast.error(err.message || 'فشل إرسال رمز التحقق'); + toast.error(err.message || t('accountVerification.otpSendFailed')); } finally { setSendingEmailOTP(false); } @@ -60,7 +62,7 @@ export default function AccountVerificationPage() { const handleVerifyEmail = async () => { if (!emailCode.trim()) { - toast.error('الرجاء إدخال رمز التحقق'); + toast.error(t('accountVerification.otpRequired')); return; } setVerifyingEmail(true); @@ -68,9 +70,9 @@ export default function AccountVerificationPage() { await verifyEmail(emailCode.trim()); setEmailVerified(true); setShowEmailInput(false); - toast.success('تم التحقق من البريد الإلكتروني بنجاح'); + toast.success(t('accountVerification.emailVerifiedSuccess')); } catch (err) { - toast.error(err.message || 'رمز التحقق غير صحيح'); + toast.error(err.message || t('accountVerification.otpInvalid')); } finally { setVerifyingEmail(false); } @@ -80,10 +82,10 @@ export default function AccountVerificationPage() { setSendingPhoneOTP(true); try { await sendPhoneOTP(); - toast.success('تم إرسال رمز التحقق إلى هاتفك'); + toast.success(t('accountVerification.phoneOtpSent')); setShowPhoneInput(true); } catch (err) { - toast.error(err.message || 'فشل إرسال رمز التحقق'); + toast.error(err.message || t('accountVerification.otpSendFailed')); } finally { setSendingPhoneOTP(false); } @@ -91,7 +93,7 @@ export default function AccountVerificationPage() { const handleVerifyPhone = async () => { if (!phoneCode.trim()) { - toast.error('الرجاء إدخال رمز التحقق'); + toast.error(t('accountVerification.otpRequired')); return; } setVerifyingPhone(true); @@ -99,9 +101,9 @@ export default function AccountVerificationPage() { await verifyPhone(phoneCode.trim()); setPhoneVerified(true); setShowPhoneInput(false); - toast.success('تم التحقق من رقم الهاتف بنجاح'); + toast.success(t('accountVerification.phoneVerifiedSuccess')); } catch (err) { - toast.error(err.message || 'رمز التحقق غير صحيح'); + toast.error(err.message || t('accountVerification.otpInvalid')); } finally { setVerifyingPhone(false); } @@ -144,7 +146,7 @@ export default function AccountVerificationPage() { > -

التحقق من الحساب

+

{t('accountVerification.title')}

-

البريد الإلكتروني

+

{t('accountVerification.emailSection')}

{emailVerified && ( - موثق + {t('accountVerification.verified')} )}
-

{user?.email || 'بريد إلكتروني غير مسجل'}

+

{user?.email || t('accountVerification.emailNotRegistered')}

{emailVerified - ? 'بريدك الإلكتروني موثق ويمكنك استخدامه لتسجيل الدخول' - : 'يرجى توثيق بريدك الإلكتروني لحماية حسابك'} + ? t('accountVerification.emailVerifiedDesc') + : t('accountVerification.emailVerifyDesc')}

{!emailVerified && !showEmailInput && ( @@ -185,7 +187,7 @@ export default function AccountVerificationPage() { ) : ( )} - {sendingEmailOTP ? 'جاري الإرسال...' : 'إرسال رمز التحقق'} + {sendingEmailOTP ? t('accountVerification.sending') : t('accountVerification.sendOtp')} )}
@@ -196,13 +198,13 @@ export default function AccountVerificationPage() { animate={{ opacity: 1, height: 'auto' }} className="space-y-3" > -

أدخل الرمز المكون من 6 أرقام الذي تم إرساله إلى بريدك الإلكتروني

+

{t('accountVerification.enter6DigitCode')}

setEmailCode(e.target.value)} - placeholder="رمز التحقق" + placeholder={t('accountVerification.otpPlaceholder')} maxLength={6} className="flex-1 px-4 py-3 border border-gray-300 rounded-xl focus:ring-2 focus:ring-amber-500 focus:border-transparent outline-none text-center text-lg tracking-widest" /> @@ -216,7 +218,7 @@ export default function AccountVerificationPage() { ) : ( )} - تحقق + {t('accountVerification.verify')}
)} @@ -232,7 +234,7 @@ export default function AccountVerificationPage() { {emailVerified && (
- تم توثيق البريد الإلكتروني بنجاح + {t('accountVerification.emailVerifiedSuccess')}
)}
@@ -241,22 +243,22 @@ export default function AccountVerificationPage() {
-

رقم الهاتف

+

{t('accountVerification.phoneSection')}

{phoneVerified && ( - موثق + {t('accountVerification.verified')} )}
-

{user?.phone || 'رقم هاتف غير مسجل'}

+

{user?.phone || t('accountVerification.phoneNotRegistered')}

{phoneVerified - ? 'رقم هاتفك موثق ويمكنك استخدامه لتسجيل الدخول' - : 'يرجى توثيق رقم هاتفك لحماية حسابك'} + ? t('accountVerification.phoneVerifiedDesc') + : t('accountVerification.phoneVerifyDesc')}

{!phoneVerified && !showPhoneInput && ( @@ -270,7 +272,7 @@ export default function AccountVerificationPage() { ) : ( )} - {sendingPhoneOTP ? 'جاري الإرسال...' : 'إرسال رمز التحقق'} + {sendingPhoneOTP ? t('accountVerification.sending') : t('accountVerification.sendOtp')} )}
@@ -281,13 +283,13 @@ export default function AccountVerificationPage() { animate={{ opacity: 1, height: 'auto' }} className="space-y-3" > -

أدخل الرمز المكون من 6 أرقام الذي تم إرساله إلى هاتفك

+

{t('accountVerification.enter6DigitCodePhone')}

setPhoneCode(e.target.value)} - placeholder="رمز التحقق" + placeholder={t('accountVerification.otpPlaceholder')} maxLength={6} className="flex-1 px-4 py-3 border border-gray-300 rounded-xl focus:ring-2 focus:ring-amber-500 focus:border-transparent outline-none text-center text-lg tracking-widest" /> @@ -301,7 +303,7 @@ export default function AccountVerificationPage() { ) : ( )} - تحقق + {t('accountVerification.verify')}
)} @@ -317,7 +319,7 @@ export default function AccountVerificationPage() { {phoneVerified && (
- تم توثيق رقم الهاتف بنجاح + {t('accountVerification.phoneVerifiedSuccess')}
)}
@@ -326,20 +328,20 @@ export default function AccountVerificationPage() {
-

لماذا يجب توثيق حسابك؟

+

{t('accountVerification.whyVerify')}

  • - حماية حسابك من الوصول غير المصرح به + {t('accountVerification.reason1')}
  • - استعادة كلمة المرور بسهولة في حال فقدانها + {t('accountVerification.reason2')}
  • - زيادة الثقة مع مالكي العقارات والمستأجرين + {t('accountVerification.reason3')}
diff --git a/app/auth/choose-role/page.js b/app/auth/choose-role/page.js index b926d4a..5b2da87 100644 --- a/app/auth/choose-role/page.js +++ b/app/auth/choose-role/page.js @@ -3,8 +3,10 @@ import { motion } from 'framer-motion'; import Link from 'next/link'; import { Home, Building, Briefcase, ArrowLeft } from 'lucide-react'; +import { useTranslation } from 'react-i18next'; export default function ChooseRolePage() { + const { t, i18n } = useTranslation(); const containerVariants = { hidden: { opacity: 0 }, visible: { @@ -35,7 +37,7 @@ export default function ChooseRolePage() { }; return ( -
+
{[...Array(20)].map((_, i) => ( - العودة للرئيسية + {t('backToHome')} @@ -89,10 +91,10 @@ export default function ChooseRolePage() { className="text-4xl md:text-5xl font-bold text-white mb-4" animate={floatingAnimation} > - مرحباً بك في SweetHome + {t('chooseRole.welcomeToSweetHome')}

- اختر نوع الحساب المناسب لك + {t('chooseRole.subtitle')}

@@ -123,23 +125,23 @@ export default function ChooseRolePage() { -

صاحب عقار

+

{t('chooseRole.owner')}

- تريد عرض عقار للإيجار أو البيع؟ انضم كمالك عقار وابدأ الآن + {t('chooseRole.ownerDesc')}

  • - إضافة عقارات غير محدودة + {t('chooseRole.ownerFeature1')}
  • - إدارة الحجوزات بسهولة + {t('chooseRole.ownerFeature2')}
  • - تواصل مباشر مع المستأجرين + {t('chooseRole.ownerFeature3')}
@@ -148,7 +150,7 @@ export default function ChooseRolePage() { whileHover={{ scale: 1.02 }} whileTap={{ scale: 0.98 }} > - إنشاء حساب مالك + {t('chooseRole.createOwnerAccount')}
@@ -181,23 +183,23 @@ export default function ChooseRolePage() { -

مستأجر / مشتري

+

{t('chooseRole.tenant')}

- تبحث عن عقار للإيجار أو الشراء؟ انضم كعميل وابحث عن منزل أحلامك + {t('chooseRole.tenantDesc')}

  • - آلاف العقارات المتاحة + {t('chooseRole.tenantFeature1')}
  • - بحث متقدم بفلاتر ذكية + {t('chooseRole.tenantFeature2')}
  • - حجز وإستئجار فوري + {t('chooseRole.tenantFeature3')}
@@ -206,7 +208,7 @@ export default function ChooseRolePage() { whileHover={{ scale: 1.02 }} whileTap={{ scale: 0.98 }} > - إنشاء حساب مستأجر + {t('chooseRole.createTenantAccount')}
@@ -239,23 +241,23 @@ export default function ChooseRolePage() {
-

وكيل عقاري

+

{t('chooseRole.agent')}

- تدير عقارات للغير؟ انضم كوسيط عقاري واحصل على فرص مميزة + {t('chooseRole.agentDesc')}

  • - إدارة عقارات العملاء + {t('chooseRole.agentFeature1')}
  • - عمولات وأرباح مضمونة + {t('chooseRole.agentFeature2')}
  • - لوحة تحكم متكاملة + {t('chooseRole.agentFeature3')}
@@ -264,7 +266,7 @@ export default function ChooseRolePage() { whileHover={{ scale: 1.02 }} whileTap={{ scale: 0.98 }} > - إنشاء حساب وكيل + {t('chooseRole.createAgentAccount')} @@ -276,12 +278,12 @@ export default function ChooseRolePage() { variants={itemVariants} className="text-center text-gray-400 mt-8" > - لديك حساب بالفعل؟{' '} + {t('chooseRole.alreadyHaveAccount')}{' '} - تسجيل الدخول + {t('login')}
diff --git a/app/blocked/page.js b/app/blocked/page.js index 2270b97..020babf 100644 --- a/app/blocked/page.js +++ b/app/blocked/page.js @@ -3,12 +3,14 @@ import { useState } from 'react'; import { useRouter } from 'next/navigation'; import { motion } from 'framer-motion'; +import { useTranslation } from 'react-i18next'; import { ShieldAlert, LogOut, MessageSquare, Send, Loader2 } from 'lucide-react'; import toast, { Toaster } from 'react-hot-toast'; import AuthService from '../services/AuthService'; import { sendGeneralReport } from '../utils/api'; export default function BlockedPage() { + const { t } = useTranslation(); const router = useRouter(); const [form, setForm] = useState({ subject: '', body: '' }); const [isSubmitting, setIsSubmitting] = useState(false); @@ -28,7 +30,7 @@ export default function BlockedPage() { event.preventDefault(); if (!form.subject.trim() || !form.body.trim()) { - toast.error('يرجى تعبئة الموضوع والرسالة'); + toast.error(t('blocked.fillAllFields')); return; } @@ -38,9 +40,9 @@ export default function BlockedPage() { await sendGeneralReport(form.subject.trim(), form.body.trim()); setIsSent(true); setForm({ subject: '', body: '' }); - toast.success('تم إرسال طلب الدعم بنجاح'); + toast.success(t('blocked.reportSent')); } catch (error) { - toast.error('حدث خطأ أثناء إرسال طلب الدعم. حاول مرة أخرى'); + toast.error(t('blocked.sendError')); } finally { setIsSubmitting(false); } @@ -63,9 +65,9 @@ export default function BlockedPage() { > -

الحساب محظور

+

{t('blocked.title')}

- تم تقييد وصولك إلى التطبيق. يمكنك تسجيل الخروج أو مراسلة دعم العملاء للمساعدة في حل المشكلة. + {t('blocked.description')}

@@ -80,9 +82,9 @@ export default function BlockedPage() {
-

تسجيل الخروج

+

{t('blocked.logoutTitle')}

- إنهاء الجلسة الحالية وإزالة بيانات الدخول من هذا الجهاز. + {t('blocked.logoutDesc')}

@@ -92,13 +94,13 @@ export default function BlockedPage() { className="mt-8 w-full bg-red-600 hover:bg-red-700 text-white rounded-2xl py-4 font-bold transition-colors flex items-center justify-center gap-3" > - تسجيل الخروج + {t('blocked.logoutButton')} @@ -107,30 +109,30 @@ export default function BlockedPage() {
-

مراسلة دعم العملاء

-

أرسل تفاصيل المشكلة وسنقوم بمراجعتها.

+

{t('blocked.contactSupportTitle')}

+

{t('blocked.contactSupportDesc')}

- + updateField('subject', event.target.value)} - placeholder="اكتب موضوع الرسالة" + placeholder={t('blocked.subjectPlaceholder')} className="w-full px-4 py-3 bg-white border border-gray-200 rounded-2xl focus:outline-none focus:ring-2 focus:ring-amber-500 focus:border-transparent text-gray-900 placeholder-gray-400" />
- +