diff --git a/public/locales/en/authentication.json b/public/locales/en/authentication.json index 9ce99c6..9265dc5 100644 --- a/public/locales/en/authentication.json +++ b/public/locales/en/authentication.json @@ -8,7 +8,10 @@ "emailIsInvalid": "Email is invalid", "phoneNumberIsInvalid": "Phone number is invalid", "thisFieldIsRequired": "This field is required", - "googleAuthenticationFailed": "Login with google failed" + "googleAuthenticationFailed": "Login with google failed", + "persian": "Persian(Fa)", + "english": "English(En)", + "accountInfo": "Harmony Account - 2025" }, "verify": { "verify": "Verify", diff --git a/public/locales/fa/authentication.json b/public/locales/fa/authentication.json index 01591a6..5c09ec3 100644 --- a/public/locales/fa/authentication.json +++ b/public/locales/fa/authentication.json @@ -8,7 +8,10 @@ "emailIsInvalid": "ایمیل وارد شده نامعتبر میباشد", "phoneNumberIsInvalid": "شماره وارد شده نامعتبر میباشد", "thisFieldIsRequired": "این فیلد الزامی است", - "googleAuthenticationFailed": "ورود با گوگل با خطا مواجه شد" + "googleAuthenticationFailed": "ورود با گوگل با خطا مواجه شد", + "persian": "فارسی(Fa)", + "english": "انگلیسی(En)", + "accountInfo": "۱۴۰۴-هارمونی اکانت" }, "verify": { "verify": "اعتبارسنجی", diff --git a/src/features/authentication/components/AuthenticationSteps/LanguageSwitcher.tsx b/src/features/authentication/components/AuthenticationSteps/LanguageSwitcher.tsx new file mode 100644 index 0000000..b751c09 --- /dev/null +++ b/src/features/authentication/components/AuthenticationSteps/LanguageSwitcher.tsx @@ -0,0 +1,46 @@ +import { Box, Typography, MenuItem, Select, Stack } from '@mui/material'; +import { Global } from 'iconsax-react'; +import { useTranslation } from 'react-i18next'; + +export default function LanguageAccountBar() { + const { t, i18n } = useTranslation('authentication'); + + const handleChange = (event: any) => { + const lang = event.target.value; + i18n.changeLanguage(lang); + document.body.dir = lang === 'fa' ? 'rtl' : 'ltr'; + }; + + return ( + + + + + + + + {t('loginForm.accountInfo')} + + + ); +} diff --git a/src/features/authentication/components/AuthenticationSteps/LoginRegiserForm.tsx b/src/features/authentication/components/AuthenticationSteps/LoginRegiserForm.tsx index 5a7e42b..0d9a792 100644 --- a/src/features/authentication/components/AuthenticationSteps/LoginRegiserForm.tsx +++ b/src/features/authentication/components/AuthenticationSteps/LoginRegiserForm.tsx @@ -15,6 +15,7 @@ import { useApi } from '@/hooks/useApi'; import type { GenerateTokenResponse } from '../../api/identityAPI'; import { GoogleAuthenticationV2 } from './GoogleAuthenticationV2'; import { replacePersianWithRealNumbers } from '@/utils/replacePersianWithRealNumbers'; +import LanguageAccountBar from './LanguageSwitcher'; export interface LoginRegisterFormProps { loginRegisterValue: string; @@ -143,72 +144,75 @@ export function LoginRegisterForm({ const showAdornment = authType === 'phone' && loginRegisterValue.length > 0; return ( - - { - e.preventDefault(); - e.stopPropagation(); - if (!userStatusLoading) { - void handleSubmit(); - } - }} - > - - {t('loginForm.title')} - - {t('loginForm.description')} - - - - - ), - startAdornment: i18n.dir() === 'ltr' && ( - - ), - }, + <> + + { + e.preventDefault(); + e.stopPropagation(); + if (!userStatusLoading) { + void handleSubmit(); + } }} - sx={{ my: 4 }} - /> + > + + {t('loginForm.title')} + + {t('loginForm.description')} + + - - - - + ), + startAdornment: i18n.dir() === 'ltr' && ( + + ), + }, + }} + sx={{ my: 4 }} /> - - - + + + + + + + + + + ); }