From cd0b9d3b718969873bf9bddbb830e2e8b4bf98a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sedat=20=C3=96ZT=C3=9CRK?= <76204082+iamsedatozturk@users.noreply.github.com> Date: Thu, 29 May 2025 10:56:27 +0300 Subject: [PATCH] Login Translate --- .../Seeds/SeederData.json | 186 ++++++++++++++++++ ui/dev-dist/sw.js | 2 +- ui/src/views/auth/ExtendLogin.tsx | 20 +- ui/src/views/auth/ForgotPassword.tsx | 16 +- ui/src/views/auth/Login.tsx | 26 +-- ui/src/views/auth/Register.tsx | 40 ++-- ui/src/views/auth/ResetPassword.tsx | 24 +-- ui/src/views/auth/SendConfirmationCode.tsx | 16 +- ui/src/views/auth/VerifyConfirmationCode.tsx | 4 +- 9 files changed, 266 insertions(+), 68 deletions(-) diff --git a/api/src/Kurs.Platform.DbMigrator/Seeds/SeederData.json b/api/src/Kurs.Platform.DbMigrator/Seeds/SeederData.json index 07e1abf6..f87f9fc9 100644 --- a/api/src/Kurs.Platform.DbMigrator/Seeds/SeederData.json +++ b/api/src/Kurs.Platform.DbMigrator/Seeds/SeederData.json @@ -1416,6 +1416,66 @@ "en": "Enable self registration Description", "tr": "Kendi kendine kaydı etkinleştir Açıklaması" }, + { + "resourceName": "Platform", + "key": "Abp.Account.WelcomeBack", + "en": "Welcome back!", + "tr": "Tekrar hoşgeldiniz!" + }, + { + "resourceName": "Platform", + "key": "Abp.Account.WelcomeBack.Message", + "en": "Please enter your credentials to sign in!", + "tr": "Giriş yapmak için lütfen kimlik bilgilerinizi girin!" + }, + { + "resourceName": "Platform", + "key": "Abp.Account.SignUp", + "en": "Sign up", + "tr": "Yeni Üye" + }, + { + "resourceName": "Platform", + "key": "Abp.Account.SignUp.Message", + "en": "Don't have an account yet?", + "tr": "Henüz bir hesabınız yok mu?" + }, + { + "resourceName": "Platform", + "key": "Abp.Account.EmailAddress", + "en": "Email Address", + "tr": "Email Adresi" + }, + { + "resourceName": "Platform", + "key": "Abp.Account.Password", + "en": "Password", + "tr": "Parola" + }, + { + "resourceName": "Platform", + "key": "Abp.Account.ConfirmPassword", + "en": "Confirm Password", + "tr": "Şifreyi Onayla" + }, + { + "resourceName": "Platform", + "key": "Abp.Account.2FACode", + "en": "2FA Code", + "tr": "İki Faktör" + }, + { + "resourceName": "Platform", + "key": "Abp.Account.RememberMe", + "en": "Remember Me", + "tr": "Beni Hatırla" + }, + { + "resourceName": "Platform", + "key": "Abp.Account.ForgotPassword", + "en": "Forgot password?", + "tr": "Şifremi Unuttum?" + }, { "resourceName": "Platform", "key": "Abp.Account.TwoFactor", @@ -1494,6 +1554,132 @@ "en": "Private Key Description", "tr": "Özel Anahtarı Açıklaması" }, + { + "resourceName": "Platform", + "key": "Abp.Account.ExtendLogin.Title", + "en": "Extension request received", + "tr": "Uzatma talebi alındı" + }, + { + "resourceName": "Platform", + "key": "Abp.Account.ExtendLogin.Description", + "en": "If your account is opened after your request is reviewed, you will also be sent an e-mail.", + "tr": "Talebiniz incelendikten sonra hesabınız açılırsa size ayrıca mail gönderilecektir." + }, + { + "resourceName": "Platform", + "key": "Abp.Account.Backto", + "en": "Back to ", + "tr": "Geri dön " + }, + { + "resourceName": "Platform", + "key": "Abp.Account.SignIn", + "en": "Sign in", + "tr": "Oturum Aç" + }, + { + "resourceName": "Platform", + "key": "Abp.Account.Register", + "en": "New register", + "tr": "Yeni Üyelik" + }, + { + "resourceName": "Platform", + "key": "Abp.Account.ExtendLogin", + "en": "Extend My Login", + "tr": "Oturumu Uzat" + }, + { + "resourceName": "Platform", + "key": "Abp.Account.ForgotPassword.Checkyouremail", + "en": "Check your email", + "tr": "E-postanızı kontrol edin" + }, + { + "resourceName": "Platform", + "key": "Abp.Account.ForgotPassword.Checkyouremail.Message", + "en": "We have sent a password recovery instruction to your email", + "tr": "E-postanıza bir şifre kurtarma talimatı gönderdik" + }, + { + "resourceName": "Platform", + "key": "Abp.Account.ForgotPassword.Message", + "en": "Please enter your email address to receive a verification code", + "tr": "Doğrulama kodunu almak için lütfen e-posta adresinizi girin" + }, + { + "resourceName": "Platform", + "key": "Abp.Account.ResetPassword.ResetDone", + "en": "Reset Done", + "tr": "Sıfırlama tamamlandı" + }, + { + "resourceName": "Platform", + "key": "Abp.Account.ResetPassword.ResetDone.Message", + "en": "Your password has been successfully reset", + "tr": "Şifreniz başarıyla sıfırlandı" + }, + { + "resourceName": "Platform", + "key": "Abp.Account.ResetPassword.SetNewPassword", + "en": "Set new password", + "tr": "Yeni şifre belirle" + }, + { + "resourceName": "Platform", + "key": "Abp.Account.ResetPassword.SetNewPassword.Message", + "en": "Your new password must different to previous password", + "tr": "Yeni şifreniz önceki şifrenizden farklı olmalıdır" + }, + { + "resourceName": "Platform", + "key": "Abp.Account.ResetPassword.Continue", + "en": "Continue", + "tr": "Devam" + }, + { + "resourceName": "Platform", + "key": "Abp.Account.SendConfirmationCode", + "en": "Confirm Email", + "tr": "E-posta Onayla" + }, + { + "resourceName": "Platform", + "key": "Abp.Account.SendConfirmationCode.Message", + "en": "Please enter your email to receive new confirmation code", + "tr": "Yeni onay kodunu almak için lütfen e-postanızı girin" + }, + { + "resourceName": "Platform", + "key": "Abp.Account.VerifyConfirmationCode", + "en": "Request New Confirmation Code", + "tr": "Yeni Onay Kodu İsteyin" + }, + { + "resourceName": "Platform", + "key": "Abp.Account.Register.Title", + "en": "Sign Up", + "tr": "Üye Ol" + }, + { + "resourceName": "Platform", + "key": "Abp.Account.Register.Message", + "en": "And let's get started with your free trial", + "tr": "Ve ücretsiz denemenize başlayalım" + }, + { + "resourceName": "Platform", + "key": "Abp.Account.Register.AlreadyHaveAnAccount", + "en": "Already have an account? ", + "tr": "Zaten bir hesabınız var mı?" + }, + { + "resourceName": "Platform", + "key": "Abp.Account.Register.ResultMessage", + "en": "Success. Please confirm your account by clicking the link.", + "tr": "Başarılı. Lütfen bağlantıya tıklayarak hesabınızı onaylayın." + }, { "resourceName": "Platform", "key": "Abp.Identity", diff --git a/ui/dev-dist/sw.js b/ui/dev-dist/sw.js index 7d82eae4..8a12b39a 100644 --- a/ui/dev-dist/sw.js +++ b/ui/dev-dist/sw.js @@ -82,7 +82,7 @@ define(['./workbox-54d0af47'], (function (workbox) { 'use strict'; "revision": "3ca0b8505b4bec776b69afdba2768812" }, { "url": "index.html", - "revision": "0.8b8tnlffsvo" + "revision": "0.952ffulqdco" }], {}); workbox.cleanupOutdatedCaches(); workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), { diff --git a/ui/src/views/auth/ExtendLogin.tsx b/ui/src/views/auth/ExtendLogin.tsx index dfe5fd5f..7f354202 100644 --- a/ui/src/views/auth/ExtendLogin.tsx +++ b/ui/src/views/auth/ExtendLogin.tsx @@ -7,6 +7,7 @@ import Input from '@/components/ui/Input' import { ROUTES_ENUM } from '@/constants/route.constant' import { sendExtendLoginRequest } from '@/proxy/account/account.service' import { store } from '@/store' +import { useLocalization } from '@/utils/hooks/useLocalization' import useTimeOutMessage from '@/utils/hooks/useTimeOutMessage' import { Field, Form, Formik } from 'formik' import { useState } from 'react' @@ -18,7 +19,7 @@ type ExtendLoginFormSchema = { } const validationSchema = Yup.object().shape({ - email: Yup.string().required('Please enter your email'), + email: Yup.string().required(), captchaResponse: Yup.string().required(), }) @@ -30,6 +31,7 @@ const ExtendLogin = () => { const [emailSent, setEmailSent] = useState(false) const [message, setMessage] = useTimeOutMessage(10000) + const { translate } = useLocalization() const onSendMail = async ( values: ExtendLoginFormSchema, @@ -51,17 +53,17 @@ const ExtendLogin = () => { return emailSent ? ( <> -

Uzatma talebi alındı

-

Talebiniz incelendikten sonra hesabınız açılırsa size ayrıca mail gönderilecektir.

+

{ translate('::Abp.Account.ExtendLogin.Title')}

+

{ translate('::Abp.Account.ExtendLogin.Description')}

- Back to - Sign in + {translate('::Abp.Account.Backto')} + { translate('::Abp.Account.SignIn')}
{' '} ) : (
-

Extend My Login

+

{ translate('::Abp.Account.ExtendLogin')}

{message && ( @@ -91,7 +93,7 @@ const ExtendLogin = () => { type="email" autoComplete="off" name="email" - placeholder="Email" + placeholder={translate('::Abp.Account.EmailAddress')} component={Input} /> @@ -105,8 +107,8 @@ const ExtendLogin = () => { {emailSent ? 'Resend Email' : 'Send Email'}
- Back to - Sign in + {translate('::Abp.Account.Backto')} + { translate('::Abp.Account.SignIn')}
diff --git a/ui/src/views/auth/ForgotPassword.tsx b/ui/src/views/auth/ForgotPassword.tsx index a582793f..58a7dc2f 100644 --- a/ui/src/views/auth/ForgotPassword.tsx +++ b/ui/src/views/auth/ForgotPassword.tsx @@ -7,6 +7,7 @@ import Input from '@/components/ui/Input' import { ROUTES_ENUM } from '@/constants/route.constant' import { sendPasswordResetCode } from '@/proxy/account/account.service' import { store } from '@/store' +import { useLocalization } from '@/utils/hooks/useLocalization' import useTimeOutMessage from '@/utils/hooks/useTimeOutMessage' import type { AxiosError } from 'axios' import { Field, Form, Formik } from 'formik' @@ -32,6 +33,7 @@ const ForgotPassword = () => { const [emailSent, setEmailSent] = useState(false) const [message, setMessage] = useTimeOutMessage() + const { translate } = useLocalization() const onSendMail = async ( values: ForgotPasswordFormSchema, @@ -62,13 +64,13 @@ const ForgotPassword = () => {
{emailSent ? ( <> -

Check your email

-

We have sent a password recovery instruction to your email

+

{translate('::Abp.Account.ForgotPassword.Checkyouremail')}

+

{translate('::Abp.Account.ForgotPassword.Checkyouremail.Message')}

) : ( <> -

Forgot Password

-

Please enter your email address to receive a verification code

+

{ translate('::Abp.Account.ForgotPassword')}

+

{ translate('::Abp.Account.ForgotPassword.Message')}

)}
@@ -100,7 +102,7 @@ const ForgotPassword = () => { type="email" autoComplete="off" name="email" - placeholder="Email" + placeholder={translate('::Abp.Account.EmailAddress')} component={Input} /> @@ -114,8 +116,8 @@ const ForgotPassword = () => { {emailSent ? 'Resend Email' : 'Send Email'}
- Back to - Sign in + {translate('::Abp.Account.Backto')} + { translate('::Abp.Account.SignIn')}
diff --git a/ui/src/views/auth/Login.tsx b/ui/src/views/auth/Login.tsx index 438338bf..8a5e0feb 100644 --- a/ui/src/views/auth/Login.tsx +++ b/ui/src/views/auth/Login.tsx @@ -202,13 +202,13 @@ const Login = () => { transition={{ duration: 0.5, origin: 1 }} >
-

Welcome back!

-

Please enter your credentials to sign in!

+

{translate('::Abp.Account.WelcomeBack')}

+

{translate('::Abp.Account.WelcomeBack.Message')}

{isMultiTenant && ( <>
{ {!twoFactor && ( @@ -246,35 +246,35 @@ const Login = () => { type="text" autoComplete="off" name="userName" - placeholder="Email" + placeholder={translate('::Abp.Account.EmailAddress')} component={Input} /> )} {!twoFactor && ( )} {twoFactor && ( @@ -282,9 +282,9 @@ const Login = () => {
- Remember Me + {translate('::Abp.Account.RememberMe')} - Forgot Password? + {translate('::Abp.Account.ForgotPassword')}
{showCaptcha && ( { {isSubmitting ? 'Signing in...' : 'Sign In'}
- Dont have an account yet? - Sign up + {translate('::Abp.Account.SignUp.Message')} + {translate('::Abp.Account.Register')}
diff --git a/ui/src/views/auth/Register.tsx b/ui/src/views/auth/Register.tsx index 9e5a5db4..ca791967 100644 --- a/ui/src/views/auth/Register.tsx +++ b/ui/src/views/auth/Register.tsx @@ -11,6 +11,7 @@ import Captcha from '@/components/shared/Captcha' import { Field, Form, Formik } from 'formik' import { useState } from 'react' import * as Yup from 'yup' +import { useLocalization } from '@/utils/hooks/useLocalization' type SignUpFormSchema = { password: string @@ -21,11 +22,11 @@ type SignUpFormSchema = { } const validationSchema = Yup.object().shape({ - email: Yup.string().email('Invalid email').required('Please enter your email'), - password: Yup.string().required('Please enter your password'), + email: Yup.string().email().required(), + password: Yup.string().required(), confirmPassword: Yup.string().oneOf([Yup.ref('password')], 'Your passwords do not match'), - name: Yup.string().required('Name is required'), - surname: Yup.string().required('Surname is required'), + name: Yup.string().required(), + surname: Yup.string().required(), }) const Register = () => { @@ -33,6 +34,7 @@ const Register = () => { const signInUrl = ROUTES_ENUM.account.login const { signUp } = useAuth() + const { translate } = useLocalization() const [message, setMessage] = useState('') const [error, setError] = useTimeOutMessage(10000) @@ -48,7 +50,7 @@ const Register = () => { setError(result.message) setMessage('') } else { - setMessage('Success. Please confirm your account by clicking the link.') + setMessage(translate('::Abp.Account.Register.ResultMessage')) window.scrollTo({ top: 0, left: 0, behavior: 'smooth' }) setError('') } @@ -59,8 +61,8 @@ const Register = () => { return ( <>
-

Sign Up

-

And lets get started with your free trial

+

{translate('::Abp.Account.Register.Title')}

+

{translate('::Abp.Account.Register.Message')}

{message && ( @@ -95,7 +97,7 @@ const Register = () => {
@@ -103,36 +105,36 @@ const Register = () => { type="email" autoComplete="off" name="email" - placeholder="Email" + placeholder={translate('::Abp.Account.EmailAddress')} component={Input} /> @@ -140,12 +142,12 @@ const Register = () => { type="name" autoComplete="off" name="name" - placeholder="Name" + placeholder={translate('::Abp.Identity.User.UserInformation.Name')} component={Input} /> @@ -153,7 +155,7 @@ const Register = () => { type="surname" autoComplete="off" name="surname" - placeholder="Surname" + placeholder={translate('::Abp.Identity.User.UserInformation.Surname')} component={Input} /> @@ -166,8 +168,8 @@ const Register = () => { {isSubmitting ? 'Creating Account...' : 'Sign Up'}
- Already have an account? - Sign in + {translate('::Abp.Account.Register.AlreadyHaveAnAccount')} + {translate('::Abp.Account.SignIn')}
diff --git a/ui/src/views/auth/ResetPassword.tsx b/ui/src/views/auth/ResetPassword.tsx index 9bd3f8eb..08d723e4 100644 --- a/ui/src/views/auth/ResetPassword.tsx +++ b/ui/src/views/auth/ResetPassword.tsx @@ -5,6 +5,7 @@ import Button from '@/components/ui/Button' import { FormContainer, FormItem } from '@/components/ui/Form' import { ROUTES_ENUM } from '@/constants/route.constant' import { resetPassword } from '@/proxy/account/account.service' +import { useLocalization } from '@/utils/hooks/useLocalization' import useTimeOutMessage from '@/utils/hooks/useTimeOutMessage' import type { AxiosError } from 'axios' import { Field, Form, Formik } from 'formik' @@ -29,6 +30,7 @@ const ResetPassword = () => { const [searchParams] = useSearchParams() const userId = searchParams.get('userId') const resetToken = searchParams.get('resetToken') + const { translate } = useLocalization() // bu olmadan da oluyor sanırım // const result = useQuery({ @@ -78,13 +80,13 @@ const ResetPassword = () => {
{resetComplete ? ( <> -

Reset done

-

Your password has been successfully reset

+

{translate('::Abp.Account.ResetPassword.ResetDone')}

+

{translate('::Abp.Account.ResetPassword.ResetDone.Message')}

) : ( <> -

Set new password

-

Your new password must different to previos password

+

{translate('::Abp.Account.ResetPassword.SetNewPassword')}

+

{translate('::Abp.Account.ResetPassword.SetNewPassword.Message')}

)}
@@ -113,26 +115,26 @@ const ResetPassword = () => { {!resetComplete ? ( <> @@ -142,13 +144,13 @@ const ResetPassword = () => { ) : ( )}
- Back to - Sign in + {translate('::Abp.Account.Backto')} + {translate('::Abp.Account.SignIn')}
diff --git a/ui/src/views/auth/SendConfirmationCode.tsx b/ui/src/views/auth/SendConfirmationCode.tsx index eb39d0e1..3b3b5353 100644 --- a/ui/src/views/auth/SendConfirmationCode.tsx +++ b/ui/src/views/auth/SendConfirmationCode.tsx @@ -6,6 +6,7 @@ import { ActionLink } from '@/components/shared' import { ROUTES_ENUM } from '@/constants/route.constant' import { store } from '@/store' import Captcha from '@/components/shared/Captcha' +import { useLocalization } from '@/utils/hooks/useLocalization' type FormSchema = { email: string @@ -13,12 +14,13 @@ type FormSchema = { } const validationSchema = Yup.object().shape({ - email: Yup.string().required('Please enter your user email'), + email: Yup.string().required(), captchaResponse: Yup.string().required(), }) const SendConfirmationCode = () => { const { userName } = store.getState().auth.user + const { translate } = useLocalization() const { message, error, sendConfirmationCode } = useAccount() @@ -33,8 +35,8 @@ const SendConfirmationCode = () => { return ( <>
-

Confirm Email

-

Please enter your email to receive new confirmation code

+

{translate('::Abp.Account.SendConfirmationCode')}

+

{translate('::Abp.Account.SendConfirmationCode.Message')}

{message && ( @@ -61,7 +63,7 @@ const SendConfirmationCode = () => {
@@ -69,7 +71,7 @@ const SendConfirmationCode = () => { type="email" autoComplete="off" name="email" - placeholder="Email" + placeholder={translate('::Abp.Account.EmailAddress')} component={Input} /> @@ -82,8 +84,8 @@ const SendConfirmationCode = () => { {isSubmitting ? 'Sending code...' : 'Send Code'}
- Back to - Login + {translate('::Abp.Account.Backto')} + {translate('::Abp.Account.SignIn')}
diff --git a/ui/src/views/auth/VerifyConfirmationCode.tsx b/ui/src/views/auth/VerifyConfirmationCode.tsx index 7f4ba6b2..319b5f3b 100644 --- a/ui/src/views/auth/VerifyConfirmationCode.tsx +++ b/ui/src/views/auth/VerifyConfirmationCode.tsx @@ -2,11 +2,13 @@ import { useQuery } from '@tanstack/react-query' import { Alert, Button } from '@/components/ui' import { useNavigate, useParams } from 'react-router-dom' import useAccount from '@/utils/hooks/useAccount' +import { useLocalization } from '@/utils/hooks/useLocalization' const VerifyConfirmationCode = () => { const { userId, token } = useParams() const { message, error, verifyConfirmationCode } = useAccount() const navigate = useNavigate() + const { translate } = useLocalization() useQuery({ queryKey: ['verifyConfirmationCode', userId, token], @@ -29,7 +31,7 @@ const VerifyConfirmationCode = () => { {error}
)}