I18n components (#27)

* 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

* Move into function

* Replace string matching to boolean check

* Add FIXIT in UsersTable

* Use localization for size units

* Missed and restored translation keys

* fixup! New translation keys in tr-TR locale

* Add translation keys in components
This commit is contained in:
vlalx 2025-05-25 17:41:38 +03:00 committed by GitHub
parent af3694da34
commit ea24759bb3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
42 changed files with 1419 additions and 329 deletions

View file

@ -32,6 +32,7 @@ import { toast } from "@app/hooks/useToast";
import { formatAxiosError } from "@app/lib/api";
import { useUserContext } from "@app/hooks/useUserContext";
import { CheckCircle2 } from "lucide-react";
import { useTranslations } from "next-intl";
const disableSchema = z.object({
password: z.string().min(1, { message: "Password is required" }),
@ -60,6 +61,8 @@ export default function Disable2FaForm({ open, setOpen }: Disable2FaProps) {
}
});
const t = useTranslations();
const request2fa = async (values: z.infer<typeof disableSchema>) => {
setLoading(true);
@ -70,10 +73,10 @@ export default function Disable2FaForm({ open, setOpen }: Disable2FaProps) {
} as Disable2faBody)
.catch((e) => {
toast({
title: "Unable to disable 2FA",
title: t('otpErrorDisable'),
description: formatAxiosError(
e,
"An error occurred while disabling 2FA"
t('otpErrorDisableDescription')
),
variant: "destructive"
});
@ -109,10 +112,10 @@ export default function Disable2FaForm({ open, setOpen }: Disable2FaProps) {
<CredenzaContent>
<CredenzaHeader>
<CredenzaTitle>
Disable Two-factor Authentication
{t('otpRemove')}
</CredenzaTitle>
<CredenzaDescription>
Disable two-factor authentication for your account
{t('otpRemoveDescription')}
</CredenzaDescription>
</CredenzaHeader>
<CredenzaBody>
@ -129,7 +132,7 @@ export default function Disable2FaForm({ open, setOpen }: Disable2FaProps) {
name="password"
render={({ field }) => (
<FormItem>
<FormLabel>Password</FormLabel>
<FormLabel>{t('password')}</FormLabel>
<FormControl>
<Input
type="password"
@ -147,7 +150,7 @@ export default function Disable2FaForm({ open, setOpen }: Disable2FaProps) {
render={({ field }) => (
<FormItem>
<FormLabel>
Authenticator Code
{t('otpSetupSecretCode')}
</FormLabel>
<FormControl>
<Input {...field} />
@ -168,19 +171,17 @@ export default function Disable2FaForm({ open, setOpen }: Disable2FaProps) {
size={48}
/>
<p className="font-semibold text-lg">
Two-Factor Authentication Disabled
{t('otpRemoveSuccess')}
</p>
<p>
Two-factor authentication has been disabled for
your account. You can enable it again at any
time.
{t('otpRemoveSuccessMessage')}
</p>
</div>
)}
</CredenzaBody>
<CredenzaFooter>
<CredenzaClose asChild>
<Button variant="outline">Close</Button>
<Button variant="outline">{t('close')}</Button>
</CredenzaClose>
{step === "password" && (
<Button
@ -189,7 +190,7 @@ export default function Disable2FaForm({ open, setOpen }: Disable2FaProps) {
loading={loading}
disabled={loading}
>
Disable 2FA
{t('otpRemoveSubmit')}
</Button>
)}
</CredenzaFooter>