refactor: Improve i18n for verify email

This commit is contained in:
Myzel394 2023-03-04 21:51:41 +01:00
parent 6370f367ed
commit e4fdcecbe6
No known key found for this signature in database
GPG Key ID: 79CC92F37B3E1A2B
3 changed files with 12 additions and 18 deletions

View File

@ -26,19 +26,6 @@
"title": "Overview", "title": "Overview",
"description": "Not much to see here, yet." "description": "Not much to see here, yet."
}, },
"SignupRoute": {
"forms": {
"mailVerification": {
"title": "You got mail!",
"description": "We sent you an email with a link to confirm your email address. Please check your inbox and click on the link to continue.",
"editEmail": {
"title": "Edit email address?",
"description": "Would you like to return to the previous step and edit your email address?",
"continueAction": "Yes, edit email"
}
}
}
},
"VerifyEmailRoute": { "VerifyEmailRoute": {
"title": "Verify your email", "title": "Verify your email",
"isLoading": "Verifying your email...", "isLoading": "Verifying your email...",

View File

@ -0,0 +1,7 @@
{
"title": "Verify your email",
"isLoading": "We are verifying your email address...",
"errors": {
"invalid": "The verification link is invalid or has expired."
}
}

View File

@ -17,9 +17,9 @@ import {AuthContext} from "~/components"
const emailSchema = yup.string().email() const emailSchema = yup.string().email()
export default function VerifyEmailRoute(): ReactElement { export default function VerifyEmailRoute(): ReactElement {
const {t} = useTranslation("verify-email")
const theme = useTheme() const theme = useTheme()
const navigate = useNavigate() const navigate = useNavigate()
const {t} = useTranslation()
const {login} = useContext(AuthContext) const {login} = useContext(AuthContext)
const [_, setEmail] = useLocalStorage<string>("signup-form-state-email", "") const [_, setEmail] = useLocalStorage<string>("signup-form-state-email", "")
@ -32,7 +32,7 @@ export default function VerifyEmailRoute(): ReactElement {
const tokenSchema = yup const tokenSchema = yup
.string() .string()
.length(serverSettings.emailVerificationLength) .length(serverSettings.emailVerificationLength)
.test("token", t("routes.VerifyEmailRoute.errors.code.invalid") as string, token => { .test("token", t("errors.invalid") as string, token => {
if (!token) { if (!token) {
return false return false
} }
@ -69,13 +69,13 @@ export default function VerifyEmailRoute(): ReactElement {
> >
<Grid item> <Grid item>
<Typography variant="h5" component="h1" align="center"> <Typography variant="h5" component="h1" align="center">
{t("routes.VerifyEmailRoute.title")} {t("title")}
</Typography> </Typography>
</Grid> </Grid>
{loading ? ( {loading ? (
<Grid item> <Grid item>
<Typography variant="subtitle1" component="p" align="center"> <Typography variant="subtitle1" component="p" align="center">
{t("routes.VerifyEmailRoute.isLoading")} {t("isLoading")}
</Typography> </Typography>
</Grid> </Grid>
) : ( ) : (
@ -85,7 +85,7 @@ export default function VerifyEmailRoute(): ReactElement {
</Grid> </Grid>
<Grid item> <Grid item>
<Typography variant="subtitle1" component="p" align="center"> <Typography variant="subtitle1" component="p" align="center">
{t("routes.VerifyEmailRoute.isCodeInvalid")} {t("errors.invalid")}
</Typography> </Typography>
</Grid> </Grid>
</> </>