I18n auth (#23)

* New translation keys in en-US locale

* New translation keys in de-DE locale

* New translation keys in fr-FR locale

* New translation keys in it-IT locale

* New translation keys in pl-PL locale

* New translation keys in pt-PT locale

* New translation keys in tr-TR locale

* Add translation keys in app/auth

* Fix build

---------

Co-authored-by: Lokowitz <marvinlokowitz@gmail.com>
This commit is contained in:
vlalx 2025-05-17 19:11:56 +03:00 committed by GitHub
parent d2d84be99a
commit b8ed5ac1c5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
23 changed files with 727 additions and 115 deletions

View file

@ -44,6 +44,7 @@ import { useEnvContext } from "@app/hooks/useEnvContext";
import { REGEXP_ONLY_DIGITS_AND_CHARS } from "input-otp";
import { passwordSchema } from "@server/auth/passwordSchema";
import { cleanRedirect } from "@app/lib/cleanRedirect";
import { useTranslations } from "next-intl";
const requestSchema = z.object({
email: z.string().email()
@ -122,6 +123,8 @@ export default function ResetPasswordForm({
}
});
const t = useTranslations();
async function onRequest(data: z.infer<typeof requestSchema>) {
const { email } = data;
@ -200,9 +203,9 @@ export default function ResetPasswordForm({
<div>
<Card className="w-full max-w-md">
<CardHeader>
<CardTitle>Reset Password</CardTitle>
<CardTitle>{t('passwordReset')}</CardTitle>
<CardDescription>
Follow the steps to reset your password
{t('passwordResetDescription')}
</CardDescription>
</CardHeader>
<CardContent>
@ -221,14 +224,13 @@ export default function ResetPasswordForm({
name="email"
render={({ field }) => (
<FormItem>
<FormLabel>Email</FormLabel>
<FormLabel>{t('email')}</FormLabel>
<FormControl>
<Input {...field} />
</FormControl>
<FormMessage />
<FormDescription>
We'll send a password reset
code to this email address.
{t('passwordResetSent')}
</FormDescription>
</FormItem>
)}
@ -249,7 +251,7 @@ export default function ResetPasswordForm({
name="email"
render={({ field }) => (
<FormItem>
<FormLabel>Email</FormLabel>
<FormLabel>{t('email')}</FormLabel>
<FormControl>
<Input
{...field}
@ -268,7 +270,7 @@ export default function ResetPasswordForm({
render={({ field }) => (
<FormItem>
<FormLabel>
Reset Code
{t('passwordResetCode')}
</FormLabel>
<FormControl>
<Input
@ -278,8 +280,7 @@ export default function ResetPasswordForm({
</FormControl>
<FormMessage />
<FormDescription>
Check your email for the
reset code.
{t('passwordResetCodeDescription')}
</FormDescription>
</FormItem>
)}
@ -292,7 +293,7 @@ export default function ResetPasswordForm({
render={({ field }) => (
<FormItem>
<FormLabel>
New Password
{t('passwordNew')}
</FormLabel>
<FormControl>
<Input
@ -310,7 +311,7 @@ export default function ResetPasswordForm({
render={({ field }) => (
<FormItem>
<FormLabel>
Confirm New Password
{t('passwordNewConfirm')}
</FormLabel>
<FormControl>
<Input
@ -339,7 +340,7 @@ export default function ResetPasswordForm({
render={({ field }) => (
<FormItem>
<FormLabel>
Authenticator Code
{t('pincodeAuth')}
</FormLabel>
<FormControl>
<div className="flex justify-center">
@ -407,8 +408,8 @@ export default function ResetPasswordForm({
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
)}
{state === "reset"
? "Reset Password"
: "Submit Code"}
? t('passwordReset')
: t('pincodeSubmit2')}
</Button>
)}
@ -422,7 +423,7 @@ export default function ResetPasswordForm({
{isSubmitting && (
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
)}
Request Reset
{t('passwordResetSubmit')}
</Button>
)}
@ -436,7 +437,7 @@ export default function ResetPasswordForm({
mfaForm.reset();
}}
>
Back to Password
{t('passwordBack')}
</Button>
)}
@ -450,7 +451,7 @@ export default function ResetPasswordForm({
form.reset();
}}
>
Back to Email
{t('backToEmail')}
</Button>
)}
</div>