From 5331ecccc104d16975357dcaf01e7af52069b31c Mon Sep 17 00:00:00 2001 From: Amruth Pillai Date: Thu, 19 Jan 2023 07:51:43 +0100 Subject: [PATCH] i18n-ize the user profile modal --- client/modals/auth/UserProfileModal.tsx | 39 ++++++++++++++----------- client/public/locales/en/modals.json | 25 ++++++++++++++++ 2 files changed, 47 insertions(+), 17 deletions(-) diff --git a/client/modals/auth/UserProfileModal.tsx b/client/modals/auth/UserProfileModal.tsx index f188e1e8..b83f831b 100644 --- a/client/modals/auth/UserProfileModal.tsx +++ b/client/modals/auth/UserProfileModal.tsx @@ -3,6 +3,7 @@ import { CrisisAlert, ManageAccounts } from '@mui/icons-material'; import { Button, Divider, TextField } from '@mui/material'; import Joi from 'joi'; import { useRouter } from 'next/router'; +import { Trans, useTranslation } from 'next-i18next'; import { useEffect, useMemo, useState } from 'react'; import { Controller, useForm } from 'react-hook-form'; import { useMutation } from 'react-query'; @@ -34,6 +35,8 @@ const schema = Joi.object({ const UserProfileModal = () => { const router = useRouter(); + const { t } = useTranslation(); + const dispatch = useAppDispatch(); const [deleteText, setDeleteText] = useState(''); @@ -86,7 +89,7 @@ const UserProfileModal = () => { render={({ field, fieldState }) => ( { )} /> -

- You can update your profile picture on{' '} - - Gravatar - +

+ + You can update your profile picture on{' '} + + Gravatar + +

@@ -109,16 +114,16 @@ const UserProfileModal = () => { render={({ field, fieldState }) => ( )} />
- +
@@ -128,21 +133,21 @@ const UserProfileModal = () => {
-
Danger Zone
+
{t('modals.auth.profile.delete-account.heading')}
-

- To delete your account, your data and all your resumes, type{' '} - 'delete' into the text box below and click on the button. Please - note that this is an irreversible action and your data cannot be retrieved again. -

+

{t('modals.auth.profile.delete-account.body', { keyword: 'delete' })}

- setDeleteText(e.target.value)} /> + setDeleteText(e.target.value)} + />
diff --git a/client/public/locales/en/modals.json b/client/public/locales/en/modals.json index 96c2a81f..a4491671 100644 --- a/client/public/locales/en/modals.json +++ b/client/public/locales/en/modals.json @@ -71,6 +71,31 @@ } }, "heading": "Reset your password" + }, + "profile": { + "heading": "Your Account", + "form": { + "avatar": { + "help-text": "You can update your profile picture on <1>Gravatar" + }, + "name": { + "label": "Full Name" + }, + "email": { + "label": "Email Address", + "help-text": "It is not possible to update your email address at the moment, please create a new account instead." + } + }, + "delete-account": { + "heading": "Delete Account and Data", + "body": "To delete your account, your data and all your resumes, type \"{{keyword}}\" into the textbox and click on the button. Please note that this is an irreversible action and your data cannot be retrieved again.", + "actions": { + "delete": "Delete Account" + } + }, + "actions": { + "save": "Save Changes" + } } }, "dashboard": {