From 632a3cdefdbb0faa4a4bfb330a79427d648e4778 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=AAEhab=20Yousef=E2=80=AC=E2=80=8F?= <74505597+ehabyousef@users.noreply.github.com> Date: Thu, 13 Jun 2024 17:53:15 +0300 Subject: [PATCH 01/24] localization --- wannameal/public/locales/ar/translation.json | 71 ++++++++++++++++-- wannameal/public/locales/en/translation.json | 61 +++++++++++++++- .../components/landingPage/LandingPage.jsx | 8 ++- .../components/landingPage/landing.module.css | 35 ++++++--- .../languageSelector/LanguageSelector.jsx | 6 +- wannameal/src/pages/addProduct/addProduct.jsx | 31 ++++---- wannameal/src/pages/contact/contact.jsx | 21 +++--- .../src/pages/profile/edit/editProfile.jsx | 72 ++++++++----------- .../pages/profile/edit/editProfile.module.css | 2 +- wannameal/src/pages/profile/profile.jsx | 32 +++++---- .../src/pages/profile/profile.module.css | 1 + 11 files changed, 235 insertions(+), 105 deletions(-) diff --git a/wannameal/public/locales/ar/translation.json b/wannameal/public/locales/ar/translation.json index 60f9928..9b5da19 100644 --- a/wannameal/public/locales/ar/translation.json +++ b/wannameal/public/locales/ar/translation.json @@ -1,8 +1,67 @@ { - "Where!?!?!?!": "صفحة الاولية", - "heading": "الصحة تتطلب اكل صحى", - "mini": "تحكم فى وجباتك باسهل طريقة", - "intro_p1": "شارك وجباتك مع اصدقائك واستكشف الجديد", - "intro_p2": "تعرف على أجزاء الوجبة ومما تتكون والمكونات التي يحتوي عليها كل جزيء.", - "mainBtn": "اصنع وجبة" + "Where!?!?!?!": "الصفحة الرئيسية", + "heading": "الصحة تتطلب طعامًا صحيًا", + "mini": "إدارة وصفاتك بالطريقة السهلة", + "intro_p1": "شارك الوصفات مع أصدقائك واكتشف وصفات جديدة", + "intro_p2": "اعرف أجزاء الوجبة ومكوناتها وما تحتويه كل جزيئة.", + "mainBtn": "قم بإعداد وجبة", + "profile": { + "name": "{{fullname}}", + "Nickname": "{{nickname}}", + "edit": "تعديل الملف الشخصي", + "share": "مشاركة الملف الشخصي", + "followers": "المتابعون", + "following": "اتابع", + "savedRE": "الوصفات المحفوظة", + "MyRE": "وصفاتي" + }, + "editprofile": { + "setting": "الإعدادات الشخصية", + "Profile": "الملف الشخصي", + "info": "سيتم عرض هذه المعلومات بشكل عام، لذا كن حذرًا فيما تشاركه.", + "fname": "الاسم الأول", + "lname": "الاسم الأخير", + "Email": "البريد الإلكتروني", + "image": "صورة الملف الشخصي", + "change": "تغيير الصورة", + "delte": "حذف", + "changePass": "تغيير كلمة المرور", + "info2": "سيتم استخدام هذا لتسجيل الدخول إلى حسابك وإكمال الإجراءات ذات الحساسية العالية.", + "CurrentPass": "كلمة المرور الحالية", + "NewPass": "كلمة المرور الجديدة", + "ConfirmPass": "تأكيد كلمة المرور", + "savedCH": "تم حفظ التغييرات", + "cancel": "إلغاء التغييرات", + "deltePers": "حذف الحساب الشخصي", + "info3": "لم تعد بحاجة إلى WeCraft؟ نحن نفهم ذلك ونقدر استخدامك لخدمتنا!", + "delteAcc": "حذف الحساب؟" + }, + "add": { + "Rname": "اسم الوصفة", + "Special": "ما يميز هذه الوصفة", + "share": "شارك معنا صورة الوصفة", + "breaks": "فطور", + "lunch": "غداء", + "dinner": "عشاء", + "enough": "يكفي لـ", + "time": "وقت التحضير", + "Ingredients": "المكونات", + "Ingredient": "مكون", + "Directions": "التوجيهات", + "Direction": "توجيه", + "addingredient": "أضف مكون", + "addStep": "أضف خطوة", + "saveRecipe": "احفظ الوصفة", + "cancelRecipe": "ألغِ الوصفة" + }, + "contact": { + "head": "تواصل معنا", + "fname": "اسمك", + "Email": "بريدك الإلكتروني", + "msg": "أدخل رسالتك", + "send": "إرسال", + "location": "جامعة قناة السويس", + "phone": "010-11-0101010-14-52", + "mail": "Teem-ala-alaah@gmail.com" + } } diff --git a/wannameal/public/locales/en/translation.json b/wannameal/public/locales/en/translation.json index 9827dea..17eb9c5 100644 --- a/wannameal/public/locales/en/translation.json +++ b/wannameal/public/locales/en/translation.json @@ -4,5 +4,64 @@ "mini": "Manage your recipes the easy way", "intro_p1": "Share Recipes With Your Friends And Discover New Ones", "intro_p2": "Know The Parts Of The Meal And What It Consists Of And The Components That Each Molecule Contains.", - "mainBtn": "Make a Meal" + "mainBtn": "Make a Meal", + "profile": { + "name": "Badr Abd Elheleem Ali", + "Nickname": "@badrjr", + "edit": "edit profile", + "share": "share profile", + "followers": "followers", + "following": "following", + "savedRE": " saved recipes", + "MyRE": " My recipes" + }, + "editprofile": { + "setting": "Personal Setting", + "Profile": "Profile", + "info": "This information will be displayed publicly so be careful what you share.", + "fname": "First Name", + "lname": "last Name", + "Email": "Email", + "image": "Profile Picture", + "change": "change Picture", + "delte": "delte", + "changePass": "Change Password", + "info2": "This will be used to log into your account and complete high severity actions.", + "CurrentPass": "Current Password", + "NewPass": "New Password", + "ConfirmPass": "Current Password", + "savedCH": "saved Changes", + "cancel": "cancel Changes", + "deltePers": "Delete Personal Account", + "info3": "Don't need wecraft any longer? We understand, and appreciate you using our service!", + "delteAcc": "Delete Account?" + }, + "add": { + "Rname": "Recipe Name", + "Special": "What distinguishes this recipe", + "share": "Share with us the picture of your dish", + "breaks": "Breakfast", + "lunch": "Lunch", + "dinner": "Dinner", + "enough": "enough for", + "time": "Preparation Time", + "Ingredients": "Ingredients", + "Ingredient": "Ingredient", + "Directions": "Directions", + "Direction": "Direction", + "addingredient": "add ingredient", + "addStep": "add Step", + "saveRecipe": "save Recipe", + "cancelRecipe": "cancel Recipe" + }, + "contact": { + "head":"get in touch", + "fname": "Your Name", + "Email": "Your Email", + "msg": "enter your message", + "send": "send", + "location": "Suez Canal University", + "phone": " 010-11-0101010-14-52", + "mail": "Teem-ala-alaah@gmail.com" + } } diff --git a/wannameal/src/components/landingPage/LandingPage.jsx b/wannameal/src/components/landingPage/LandingPage.jsx index 19c314d..4f85cd9 100644 --- a/wannameal/src/components/landingPage/LandingPage.jsx +++ b/wannameal/src/components/landingPage/LandingPage.jsx @@ -1,4 +1,4 @@ -import React from "react"; +import React, { } from "react"; import rec2 from "../../assets/Rectangle 2.png"; import rec3 from "../../assets/Rectangle 3.png"; import rec4 from "../../assets/Rectangle 4.png"; @@ -12,7 +12,9 @@ import { motion } from "framer-motion" import styles from './landing.module.css'; import { useTranslation } from "react-i18next"; export default function LandingPage() { - const { t } = useTranslation() + const { t, i18n } = useTranslation() + const isAr = i18n.dir(); + console.log(isAr); return (
@@ -33,7 +35,7 @@ export default function LandingPage() { -
+
{ i18n.changeLanguage(lng) } - // useEffect(() => { - // document.body.dir = i18n.dir() - // }, [i18n, i18n.language]) + useEffect(() => { + document.body.dir = i18n.dir() + }, [i18n, i18n.language]) return ( <> diff --git a/wannameal/src/pages/addProduct/addProduct.jsx b/wannameal/src/pages/addProduct/addProduct.jsx index b2ec396..80dc851 100644 --- a/wannameal/src/pages/addProduct/addProduct.jsx +++ b/wannameal/src/pages/addProduct/addProduct.jsx @@ -5,12 +5,15 @@ import { IoMdAddCircleOutline } from "react-icons/io"; import { MdCheckCircleOutline } from "react-icons/md"; import { CiCamera } from "react-icons/ci"; import axios from "axios"; +import { useTranslation } from 'react-i18next'; const AddProduct = () => { // Changed from addProduct to AddProduct const [ingredientsValue, setIngredientsValue] = useState([{ id: 1, value: "" }]); const [directionsValue, setDirectionsValue] = useState([{ id: 1, value: "" }]); const [isActive, setisActive] = useState(""); const [image, setImage] = useState(null); + const { t } = useTranslation() + const { Rname, Special, share, breaks, lunch, dinner, enough, time, Ingredients, Directions, addingredient, addStep, saveRecipe, cancelRecipe } = t('add') const [recipe, setRecipe] = useState({ recipeName: "", information: "", @@ -166,7 +169,7 @@ const AddProduct = () => { // Changed from addProduct to AddProduct value={recipe.recipeName} name="recipeName" type="text" - placeholder="Recipe Name :" + placeholder={`${Rname} :`} /> { // Changed from addProduct to AddProduct value={recipe.information} name="information" type="text" - placeholder="What distinguishes this recipe ?" + placeholder={`${Special} :`} />
-

Enough For

+

{enough}

{ // Changed from addProduct to AddProduct />
-

Preparation time

+

{time}

{ // Changed from addProduct to AddProduct
- Share with us the picture of your dish + {share}
)} @@ -282,7 +285,7 @@ const AddProduct = () => { // Changed from addProduct to AddProduct
-

Ingredients

+

{Ingredients}

{ingredientsValue.map((ingredient, index) => ( @@ -307,12 +310,12 @@ const AddProduct = () => { // Changed from addProduct to AddProduct ))}
-

Directions

+

{Directions}

{directionsValue.map((direction, index) => ( @@ -337,7 +340,7 @@ const AddProduct = () => { // Changed from addProduct to AddProduct ))}
@@ -345,11 +348,11 @@ const AddProduct = () => { // Changed from addProduct to AddProduct
diff --git a/wannameal/src/pages/contact/contact.jsx b/wannameal/src/pages/contact/contact.jsx index 9427d38..a485d01 100644 --- a/wannameal/src/pages/contact/contact.jsx +++ b/wannameal/src/pages/contact/contact.jsx @@ -7,15 +7,16 @@ import { TiSocialFacebook } from "react-icons/ti"; import { FaXTwitter } from "react-icons/fa6"; import { TiSocialLinkedin } from "react-icons/ti"; import "animate.css"; +import { useTranslation } from "react-i18next"; function ContactUs() { + const { t } = useTranslation() + const { head, fname, Email, msg, send, location, phone, mail } = t('contact') return (
-
- get in touch -
+
{head}
@@ -28,7 +29,7 @@ function ContactUs() { name="name" className={`form-control ${styles.input}`} id="exampleFormControlInput1" - placeholder="Your Name" + placeholder={fname} />
@@ -37,21 +38,21 @@ function ContactUs() { name="email" className={`form-control ${styles.input}`} id="exampleFormControlInput1" - placeholder="Your Email " + placeholder={Email} />