diff --git a/apps/login/src/app/(login)/otp/[method]/page.tsx b/apps/login/src/app/(login)/otp/[method]/page.tsx index 08007c1819..2d9daac64f 100644 --- a/apps/login/src/app/(login)/otp/[method]/page.tsx +++ b/apps/login/src/app/(login)/otp/[method]/page.tsx @@ -11,7 +11,7 @@ import { getLoginSettings, getSession, } from "@/lib/zitadel"; -import { getLocale, getTranslations } from "next-intl/server"; +import { getLocale } from "next-intl/server"; import { headers } from "next/headers"; export default async function Page(props: { @@ -21,7 +21,6 @@ export default async function Page(props: { const params = await props.params; const searchParams = await props.searchParams; const locale = getLocale(); - const t = await getTranslations({ locale, namespace: "otp" }); const _headers = await headers(); const { serviceUrl } = getServiceUrlFromHeaders(_headers); @@ -81,15 +80,23 @@ export default async function Page(props: { return (
-

{t("verify.title")}

+

+ +

{method === "time-based" && ( -

{t("verify.totpDescription")}

+

+ +

)} {method === "sms" && ( -

{t("verify.smsDescription")}

+

+ +

)} {method === "email" && ( -

{t("verify.emailDescription")}

+

+ +

)} {!session && ( diff --git a/apps/login/src/components/authentication-method-radio.tsx b/apps/login/src/components/authentication-method-radio.tsx index 1b2af2d167..c3b273ab46 100644 --- a/apps/login/src/components/authentication-method-radio.tsx +++ b/apps/login/src/components/authentication-method-radio.tsx @@ -1,7 +1,7 @@ "use client"; import { RadioGroup } from "@headlessui/react"; -import { useTranslations } from "next-intl"; +import { Translated } from "./translated"; export enum AuthenticationMethod { Passkey = "passkey", @@ -20,8 +20,6 @@ export function AuthenticationMethodRadio({ selected: any; selectionChanged: (value: any) => void; }) { - const t = useTranslations("register"); - return (
@@ -80,7 +78,18 @@ export function AuthenticationMethodRadio({ as="p" className={`font-medium ${checked ? "" : ""}`} > - {t(`methods.${method}`)} + {method === AuthenticationMethod.Passkey && ( + + )} + {method === AuthenticationMethod.Password && ( + + )}
diff --git a/apps/login/src/components/back-button.tsx b/apps/login/src/components/back-button.tsx index fe348af9c4..31d4a880ad 100644 --- a/apps/login/src/components/back-button.tsx +++ b/apps/login/src/components/back-button.tsx @@ -1,11 +1,10 @@ "use client"; -import { useTranslations } from "next-intl"; import { useRouter } from "next/navigation"; import { Button, ButtonVariants } from "./button"; +import { Translated } from "./translated"; export function BackButton() { - const t = useTranslations("common"); const router = useRouter(); return ( ); } diff --git a/apps/login/src/components/set-password-form.tsx b/apps/login/src/components/set-password-form.tsx index 8bd2580fb8..2c3db8dbf2 100644 --- a/apps/login/src/components/set-password-form.tsx +++ b/apps/login/src/components/set-password-form.tsx @@ -14,7 +14,6 @@ import { import { create } from "@zitadel/client"; import { ChecksSchema } from "@zitadel/proto/zitadel/session/v2/session_service_pb"; import { PasswordComplexitySettings } from "@zitadel/proto/zitadel/settings/v2/password_settings_pb"; -import { useTranslations } from "next-intl"; import { useRouter } from "next/navigation"; import { useState } from "react"; import { FieldValues, useForm } from "react-hook-form"; @@ -53,8 +52,6 @@ export function SetPasswordForm({ code, codeRequired, }: Props) { - const t = useTranslations("password"); - const { register, handleSubmit, watch, formState } = useForm({ mode: "onBlur", defaultValues: { @@ -196,7 +193,7 @@ export function SetPasswordForm({
- {t("set.noCodeReceived")} +
diff --git a/apps/login/src/components/username-form.tsx b/apps/login/src/components/username-form.tsx index 6801f6b274..6adc67fbb5 100644 --- a/apps/login/src/components/username-form.tsx +++ b/apps/login/src/components/username-form.tsx @@ -2,7 +2,6 @@ import { sendLoginname } from "@/lib/server/loginname"; import { LoginSettings } from "@zitadel/proto/zitadel/settings/v2/login_settings_pb"; -import { useTranslations } from "next-intl"; import { useRouter } from "next/navigation"; import { ReactNode, useEffect, useState } from "react"; import { useForm } from "react-hook-form"; @@ -11,6 +10,7 @@ import { BackButton } from "./back-button"; import { Button, ButtonVariants } from "./button"; import { TextInput } from "./input"; import { Spinner } from "./spinner"; +import { Translated } from "./translated"; type Inputs = { loginName: string; @@ -37,7 +37,6 @@ export function UsernameForm({ allowRegister, children, }: Props) { - const t = useTranslations("loginname"); const { register, handleSubmit, formState } = useForm({ mode: "onBlur", defaultValues: { @@ -127,7 +126,7 @@ export function UsernameForm({ disabled={loading} data-testid="register-button" > - {t("register")} + )}
diff --git a/apps/login/src/components/verify-form.tsx b/apps/login/src/components/verify-form.tsx index 0933f598dd..dac4c91314 100644 --- a/apps/login/src/components/verify-form.tsx +++ b/apps/login/src/components/verify-form.tsx @@ -2,7 +2,6 @@ import { Alert, AlertType } from "@/components/alert"; import { resendVerification, sendVerification } from "@/lib/server/verify"; -import { useTranslations } from "next-intl"; import { useRouter } from "next/navigation"; import { useCallback, useEffect, useState } from "react"; import { useForm } from "react-hook-form"; @@ -10,6 +9,7 @@ import { BackButton } from "./back-button"; import { Button, ButtonVariants } from "./button"; import { TextInput } from "./input"; import { Spinner } from "./spinner"; +import { Translated } from "./translated"; type Inputs = { code: string; @@ -32,8 +32,6 @@ export function VerifyForm({ code, isInvite, }: Props) { - const t = useTranslations("verify"); - const router = useRouter(); const { register, handleSubmit, formState } = useForm({ @@ -117,7 +115,7 @@ export function VerifyForm({
- {t("verify.noCodeReceived")} +
@@ -161,7 +159,7 @@ export function VerifyForm({ data-testid="submit-button" > {loading && } - {t("verify.submit")} +