diff --git a/apps/login/src/app/(login)/error.tsx b/apps/login/src/app/(login)/error.tsx index 37e7c5003d..d14150a4b4 100644 --- a/apps/login/src/app/(login)/error.tsx +++ b/apps/login/src/app/(login)/error.tsx @@ -2,7 +2,7 @@ import { Boundary } from "@/components/boundary"; import { Button } from "@/components/button"; -import { useTranslations } from "next-intl"; +import { Translated } from "@/components/translated"; import { useEffect } from "react"; export default function Error({ error, reset }: any) { @@ -10,8 +10,6 @@ export default function Error({ error, reset }: any) { console.log("logging error:", error); }, [error]); - const t = useTranslations("error"); - return (
@@ -20,7 +18,7 @@ export default function Error({ error, reset }: any) {
diff --git a/apps/login/src/app/global-error.tsx b/apps/login/src/app/global-error.tsx index 32a8ce824f..5111a65e8d 100644 --- a/apps/login/src/app/global-error.tsx +++ b/apps/login/src/app/global-error.tsx @@ -3,7 +3,7 @@ import { Boundary } from "@/components/boundary"; import { Button } from "@/components/button"; import { ThemeWrapper } from "@/components/theme-wrapper"; -import { useTranslations } from "next-intl"; +import { Translated } from "@/components/translated"; export default function GlobalError({ error, @@ -12,8 +12,6 @@ export default function GlobalError({ error: Error & { digest?: string }; reset: () => void; }) { - const t = useTranslations("error"); - return ( // global-error must include html and body tags @@ -26,7 +24,7 @@ export default function GlobalError({
diff --git a/apps/login/src/components/change-password-form.tsx b/apps/login/src/components/change-password-form.tsx index 54aab7b3ca..00513d8dda 100644 --- a/apps/login/src/components/change-password-form.tsx +++ b/apps/login/src/components/change-password-form.tsx @@ -13,7 +13,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"; @@ -23,6 +22,7 @@ import { Button, ButtonVariants } from "./button"; import { TextInput } from "./input"; import { PasswordComplexity } from "./password-complexity"; import { Spinner } from "./spinner"; +import { Translated } from "./translated"; type Inputs = | { @@ -46,7 +46,6 @@ export function ChangePasswordForm({ requestId, organization, }: Props) { - const t = useTranslations("password"); const router = useRouter(); const { register, handleSubmit, watch, formState } = useForm({ @@ -203,8 +202,8 @@ export function ChangePasswordForm({ onClick={handleSubmit(submitChange)} data-testid="submit-button" > - {loading && } - {t("change.submit")} + {loading && }{" "} + diff --git a/apps/login/src/components/choose-authenticator-to-setup.tsx b/apps/login/src/components/choose-authenticator-to-setup.tsx index 9075e3286e..4aa4de720a 100644 --- a/apps/login/src/components/choose-authenticator-to-setup.tsx +++ b/apps/login/src/components/choose-authenticator-to-setup.tsx @@ -3,9 +3,9 @@ import { PasskeysType, } from "@zitadel/proto/zitadel/settings/v2/login_settings_pb"; import { AuthenticationMethodType } from "@zitadel/proto/zitadel/user/v2/user_service_pb"; -import { useTranslations } from "next-intl"; import { Alert, AlertType } from "./alert"; import { PASSKEYS, PASSWORD } from "./auth-methods"; +import { Translated } from "./translated"; type Props = { authMethods: AuthenticationMethodType[]; @@ -18,16 +18,23 @@ export function ChooseAuthenticatorToSetup({ params, loginSettings, }: Props) { - const t = useTranslations("authenticator"); - if (authMethods.length !== 0) { - return {t("allSetup")}; + return ( + + + + ); } else { return ( <> {loginSettings.passkeysType == PasskeysType.NOT_ALLOWED && !loginSettings.allowUsernamePassword && ( - {t("noMethodsAvailable")} + + + )}
diff --git a/apps/login/src/components/choose-second-factor-to-setup.tsx b/apps/login/src/components/choose-second-factor-to-setup.tsx index e56379e147..edd0ae2b61 100644 --- a/apps/login/src/components/choose-second-factor-to-setup.tsx +++ b/apps/login/src/components/choose-second-factor-to-setup.tsx @@ -6,9 +6,9 @@ import { SecondFactorType, } from "@zitadel/proto/zitadel/settings/v2/login_settings_pb"; import { AuthenticationMethodType } from "@zitadel/proto/zitadel/user/v2/user_service_pb"; -import { useTranslations } from "next-intl"; import { useRouter } from "next/navigation"; import { EMAIL, SMS, TOTP, U2F } from "./auth-methods"; +import { Translated } from "./translated"; type Props = { userId: string; @@ -37,7 +37,6 @@ export function ChooseSecondFactorToSetup({ emailVerified, force, }: Props) { - const t = useTranslations("mfa"); const router = useRouter(); const params = new URLSearchParams({}); @@ -112,7 +111,7 @@ export function ChooseSecondFactorToSetup({ type="button" data-testid="reset-button" > - {t("set.skip")} + )} diff --git a/apps/login/src/components/consent.tsx b/apps/login/src/components/consent.tsx index d3d30b3113..5b21ac2a9d 100644 --- a/apps/login/src/components/consent.tsx +++ b/apps/login/src/components/consent.tsx @@ -8,6 +8,7 @@ import { useState } from "react"; import { Alert } from "./alert"; import { Button, ButtonVariants } from "./button"; import { Spinner } from "./spinner"; +import { Translated } from "./translated"; export function ConsentScreen({ scope, @@ -50,7 +51,7 @@ export function ConsentScreen({
    {scopes?.length === 0 && ( - {t("device.scope.openid")} + )} {scopes?.map((s) => { @@ -91,7 +92,7 @@ export function ConsentScreen({ data-testid="deny-button" > {loading && } - {t("device.request.deny")} + @@ -102,7 +103,7 @@ export function ConsentScreen({ className="self-end" variant={ButtonVariants.Primary} > - {t("device.request.submit")} +
diff --git a/apps/login/src/components/device-code-form.tsx b/apps/login/src/components/device-code-form.tsx index e09adb1147..a1efc07207 100644 --- a/apps/login/src/components/device-code-form.tsx +++ b/apps/login/src/components/device-code-form.tsx @@ -2,7 +2,6 @@ import { Alert } from "@/components/alert"; import { getDeviceAuthorizationRequest } from "@/lib/server/oidc"; -import { useTranslations } from "next-intl"; import { useRouter } from "next/navigation"; import { useState } from "react"; import { useForm } from "react-hook-form"; @@ -10,14 +9,13 @@ import { BackButton } from "./back-button"; import { Button, ButtonVariants } from "./button"; import { TextInput } from "./input"; import { Spinner } from "./spinner"; +import { Translated } from "./translated"; type Inputs = { userCode: string; }; export function DeviceCodeForm({ userCode }: { userCode?: string }) { - const t = useTranslations("verify"); - const router = useRouter(); const { register, handleSubmit, formState } = useForm({ @@ -87,8 +85,8 @@ export function DeviceCodeForm({ userCode }: { userCode?: string }) { onClick={handleSubmit(submitCodeAndContinue)} data-testid="submit-button" > - {loading && } - {t("verify.submit")} + {loading && }{" "} + diff --git a/apps/login/src/components/login-otp.tsx b/apps/login/src/components/login-otp.tsx index f8500f6909..4ad6cced6a 100644 --- a/apps/login/src/components/login-otp.tsx +++ b/apps/login/src/components/login-otp.tsx @@ -6,7 +6,6 @@ import { create } from "@zitadel/client"; import { RequestChallengesSchema } from "@zitadel/proto/zitadel/session/v2/challenge_pb"; import { ChecksSchema } from "@zitadel/proto/zitadel/session/v2/session_service_pb"; import { LoginSettings } from "@zitadel/proto/zitadel/settings/v2/login_settings_pb"; -import { useTranslations } from "next-intl"; import { useRouter } from "next/navigation"; import { useEffect, useRef, useState } from "react"; import { useForm } from "react-hook-form"; @@ -15,6 +14,7 @@ import { BackButton } from "./back-button"; import { Button, ButtonVariants } from "./button"; import { TextInput } from "./input"; import { Spinner } from "./spinner"; +import { Translated } from "./translated"; // either loginName or sessionId must be provided type Props = { @@ -42,8 +42,6 @@ export function LoginOTP({ code, loginSettings, }: Props) { - const t = useTranslations("otp"); - const [error, setError] = useState(""); const [loading, setLoading] = useState(false); @@ -223,7 +221,7 @@ export function LoginOTP({
- {t("verify.noCodeReceived")} +
@@ -277,8 +275,8 @@ export function LoginOTP({ })} data-testid="submit-button" > - {loading && } - {t("verify.submit")} + {loading && }{" "} + diff --git a/apps/login/src/components/login-passkey.tsx b/apps/login/src/components/login-passkey.tsx index b3f0b1212f..0b7ecd5a9e 100644 --- a/apps/login/src/components/login-passkey.tsx +++ b/apps/login/src/components/login-passkey.tsx @@ -9,13 +9,13 @@ import { UserVerificationRequirement, } from "@zitadel/proto/zitadel/session/v2/challenge_pb"; import { Checks } from "@zitadel/proto/zitadel/session/v2/session_service_pb"; -import { useTranslations } from "next-intl"; import { useRouter } from "next/navigation"; import { useEffect, useRef, useState } from "react"; import { Alert } from "./alert"; import { BackButton } from "./back-button"; import { Button, ButtonVariants } from "./button"; import { Spinner } from "./spinner"; +import { Translated } from "./translated"; // either loginName or sessionId must be provided type Props = { @@ -35,8 +35,6 @@ export function LoginPasskey({ organization, login = true, }: Props) { - const t = useTranslations("passkey"); - const [error, setError] = useState(""); const [loading, setLoading] = useState(false); @@ -234,7 +232,7 @@ export function LoginPasskey({ }} data-testid="password-button" > - {t("verify.usePassword")} + ) : ( @@ -273,8 +271,8 @@ export function LoginPasskey({ }} data-testid="submit-button" > - {loading && } - {t("verify.submit")} + {loading && }{" "} + diff --git a/apps/login/src/components/password-form.tsx b/apps/login/src/components/password-form.tsx index 17461644d8..c65a4049f8 100644 --- a/apps/login/src/components/password-form.tsx +++ b/apps/login/src/components/password-form.tsx @@ -4,7 +4,6 @@ import { resetPassword, sendPassword } from "@/lib/server/password"; import { create } from "@zitadel/client"; import { ChecksSchema } from "@zitadel/proto/zitadel/session/v2/session_service_pb"; import { LoginSettings } from "@zitadel/proto/zitadel/settings/v2/login_settings_pb"; -import { useTranslations } from "next-intl"; import { useRouter } from "next/navigation"; import { useState } from "react"; import { useForm } from "react-hook-form"; @@ -13,6 +12,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 = { password: string; @@ -35,8 +35,6 @@ export function PasswordForm({ promptPasswordless, isAlternative, }: Props) { - const t = useTranslations("password"); - const { register, handleSubmit, formState } = useForm({ mode: "onBlur", }); @@ -136,7 +134,7 @@ export function PasswordForm({ disabled={loading} data-testid="reset-button" > - {t("verify.resetPassword")} + )} @@ -173,8 +171,8 @@ export function PasswordForm({ onClick={handleSubmit(submitPassword)} data-testid="submit-button" > - {loading && } - {t("verify.submit")} + {loading && }{" "} + diff --git a/apps/login/src/components/privacy-policy-checkboxes.tsx b/apps/login/src/components/privacy-policy-checkboxes.tsx index 5ac0340bcb..4ab0e33222 100644 --- a/apps/login/src/components/privacy-policy-checkboxes.tsx +++ b/apps/login/src/components/privacy-policy-checkboxes.tsx @@ -1,9 +1,9 @@ "use client"; import { LegalAndSupportSettings } from "@zitadel/proto/zitadel/settings/v2/legal_settings_pb"; -import { useTranslations } from "next-intl"; import Link from "next/link"; import { useState } from "react"; import { Checkbox } from "./checkbox"; +import { Translated } from "./translated"; type Props = { legal: LegalAndSupportSettings; @@ -16,7 +16,6 @@ type AcceptanceState = { }; export function PrivacyPolicyCheckboxes({ legal, onChange }: Props) { - const t = useTranslations("register"); const [acceptanceState, setAcceptanceState] = useState({ tosAccepted: false, privacyPolicyAccepted: false, @@ -25,7 +24,7 @@ export function PrivacyPolicyCheckboxes({ legal, onChange }: Props) { return ( <>

- {t("agreeTo")} + {legal?.helpLink && ( @@ -66,7 +65,7 @@ export function PrivacyPolicyCheckboxes({ legal, onChange }: Props) {

- {t("termsOfService")} +

@@ -95,7 +94,7 @@ export function PrivacyPolicyCheckboxes({ legal, onChange }: Props) { className="underline" target="_blank" > - {t("privacyPolicy")} +

diff --git a/apps/login/src/components/register-form-idp-incomplete.tsx b/apps/login/src/components/register-form-idp-incomplete.tsx index 6194b34052..b8a7765c9c 100644 --- a/apps/login/src/components/register-form-idp-incomplete.tsx +++ b/apps/login/src/components/register-form-idp-incomplete.tsx @@ -1,7 +1,6 @@ "use client"; import { registerUserAndLinkToIDP } from "@/lib/server/register"; -import { useTranslations } from "next-intl"; import { useRouter } from "next/navigation"; import { useState } from "react"; import { FieldValues, 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 = | { @@ -45,8 +45,6 @@ export function RegisterFormIDPIncomplete({ idpId, idpUserName, }: Props) { - const t = useTranslations("register"); - const { register, handleSubmit, formState } = useForm({ mode: "onBlur", defaultValues: { @@ -149,8 +147,8 @@ export function RegisterFormIDPIncomplete({ onClick={handleSubmit(submitAndRegister)} data-testid="submit-button" > - {loading && } - {t("submit")} + {loading && }{" "} + diff --git a/apps/login/src/components/register-form.tsx b/apps/login/src/components/register-form.tsx index c581131c8c..6217bbcbb9 100644 --- a/apps/login/src/components/register-form.tsx +++ b/apps/login/src/components/register-form.tsx @@ -6,7 +6,6 @@ import { LoginSettings, PasskeysType, } from "@zitadel/proto/zitadel/settings/v2/login_settings_pb"; -import { useTranslations } from "next-intl"; import { useRouter } from "next/navigation"; import { useState } from "react"; import { FieldValues, useForm } from "react-hook-form"; @@ -21,6 +20,7 @@ import { Button, ButtonVariants } from "./button"; import { TextInput } from "./input"; import { PrivacyPolicyCheckboxes } from "./privacy-policy-checkboxes"; import { Spinner } from "./spinner"; +import { Translated } from "./translated"; type Inputs = | { @@ -51,8 +51,6 @@ export function RegisterForm({ loginSettings, idpCount = 0, }: Props) { - const t = useTranslations("register"); - const { register, handleSubmit, formState } = useForm({ mode: "onBlur", defaultValues: { @@ -173,7 +171,7 @@ export function RegisterForm({ loginSettings.passkeysType == PasskeysType.ALLOWED && ( <>

- {t("selectMethod")} +

@@ -184,12 +182,16 @@ export function RegisterForm({
)} - {!loginSettings?.allowUsernamePassword && - loginSettings?.passkeysType != PasskeysType.ALLOWED && + loginSettings?.passkeysType !== PasskeysType.ALLOWED && (!loginSettings?.allowExternalIdp || !idpCount) && (
- {t("noMethodAvailableWarning")} + + +
)} @@ -217,7 +219,7 @@ export function RegisterForm({ data-testid="submit-button" > {loading && } - {t("submit")} + diff --git a/apps/login/src/components/register-passkey.tsx b/apps/login/src/components/register-passkey.tsx index 8687312bbc..e21e1acdbb 100644 --- a/apps/login/src/components/register-passkey.tsx +++ b/apps/login/src/components/register-passkey.tsx @@ -5,7 +5,6 @@ import { registerPasskeyLink, verifyPasskeyRegistration, } from "@/lib/server/passkeys"; -import { useTranslations } from "next-intl"; import { useRouter } from "next/navigation"; import { useState } from "react"; import { useForm } from "react-hook-form"; @@ -13,6 +12,7 @@ import { Alert } from "./alert"; import { BackButton } from "./back-button"; import { Button, ButtonVariants } from "./button"; import { Spinner } from "./spinner"; +import { Translated } from "./translated"; type Inputs = {}; @@ -29,8 +29,6 @@ export function RegisterPasskey({ organization, requestId, }: Props) { - const t = useTranslations("passkey"); - const { handleSubmit, formState } = useForm({ mode: "onBlur", }); @@ -198,7 +196,7 @@ export function RegisterPasskey({ continueAndLogin(); }} > - {t("set.skip")} + ) : ( @@ -213,8 +211,8 @@ export function RegisterPasskey({ onClick={handleSubmit(submitRegisterAndContinue)} data-testid="submit-button" > - {loading && } - {t("set.submit")} + {loading && }{" "} + diff --git a/apps/login/src/components/register-u2f.tsx b/apps/login/src/components/register-u2f.tsx index 753eae017d..e72bf1fc69 100644 --- a/apps/login/src/components/register-u2f.tsx +++ b/apps/login/src/components/register-u2f.tsx @@ -5,13 +5,13 @@ import { getNextUrl } from "@/lib/client"; import { addU2F, verifyU2F } from "@/lib/server/u2f"; import { LoginSettings } from "@zitadel/proto/zitadel/settings/v2/login_settings_pb"; import { RegisterU2FResponse } from "@zitadel/proto/zitadel/user/v2/user_service_pb"; -import { useTranslations } from "next-intl"; import { useRouter } from "next/navigation"; import { useState } from "react"; import { Alert } from "./alert"; import { BackButton } from "./back-button"; import { Button, ButtonVariants } from "./button"; import { Spinner } from "./spinner"; +import { Translated } from "./translated"; type Props = { loginName?: string; @@ -30,8 +30,6 @@ export function RegisterU2f({ checkAfter, loginSettings, }: Props) { - const t = useTranslations("u2f"); - const [error, setError] = useState(""); const [loading, setLoading] = useState(false); @@ -218,8 +216,8 @@ export function RegisterU2f({ onClick={submitRegisterAndContinue} data-testid="submit-button" > - {loading && } - {t("set.submit")} + {loading && }{" "} + diff --git a/apps/login/src/components/session-clear-item.tsx b/apps/login/src/components/session-clear-item.tsx index 8bff33fee9..72cf51d6f5 100644 --- a/apps/login/src/components/session-clear-item.tsx +++ b/apps/login/src/components/session-clear-item.tsx @@ -9,6 +9,7 @@ import { useRouter } from "next/navigation"; import { useState } from "react"; import { Avatar } from "./avatar"; import { isSessionValid } from "./session-item"; +import { Translated } from "./translated"; export function SessionClearItem({ session, @@ -89,7 +90,7 @@ export function SessionClearItem({
- {t("clear")} +
{valid ? ( diff --git a/apps/login/src/components/sessions-clear-list.tsx b/apps/login/src/components/sessions-clear-list.tsx index fe7a67f746..5989948725 100644 --- a/apps/login/src/components/sessions-clear-list.tsx +++ b/apps/login/src/components/sessions-clear-list.tsx @@ -3,11 +3,11 @@ import { clearSession } from "@/lib/server/session"; import { timestampDate } from "@zitadel/client"; import { Session } from "@zitadel/proto/zitadel/session/v2/session_pb"; -import { useTranslations } from "next-intl"; import { redirect, useRouter } from "next/navigation"; import { useEffect, useState } from "react"; import { Alert, AlertType } from "./alert"; import { SessionClearItem } from "./session-clear-item"; +import { Translated } from "./translated"; type Props = { sessions: Session[]; @@ -22,7 +22,6 @@ export function SessionsClearList({ postLogoutRedirectUri, organization, }: Props) { - const t = useTranslations("logout"); const [list, setList] = useState(sessions); const router = useRouter(); @@ -97,10 +96,14 @@ export function SessionsClearList({ ); })} {list.length === 0 && ( - {t("noResults")} + + + )}
) : ( - {t("noResults")} + + + ); } diff --git a/apps/login/src/components/sessions-list.tsx b/apps/login/src/components/sessions-list.tsx index 50f621a62d..a3a1f8ed94 100644 --- a/apps/login/src/components/sessions-list.tsx +++ b/apps/login/src/components/sessions-list.tsx @@ -2,10 +2,10 @@ import { timestampDate } from "@zitadel/client"; import { Session } from "@zitadel/proto/zitadel/session/v2/session_pb"; -import { useTranslations } from "next-intl"; import { useState } from "react"; import { Alert } from "./alert"; import { SessionItem } from "./session-item"; +import { Translated } from "./translated"; type Props = { sessions: Session[]; @@ -13,7 +13,6 @@ type Props = { }; export function SessionsList({ sessions, requestId }: Props) { - const t = useTranslations("accounts"); const [list, setList] = useState(sessions); return sessions ? (
@@ -44,6 +43,8 @@ export function SessionsList({ sessions, requestId }: Props) { })}
) : ( - {t("noResults")} + + + ); } diff --git a/apps/login/src/components/set-password-form.tsx b/apps/login/src/components/set-password-form.tsx index 08f5c7c4ef..8bd2580fb8 100644 --- a/apps/login/src/components/set-password-form.tsx +++ b/apps/login/src/components/set-password-form.tsx @@ -24,6 +24,7 @@ import { Button, ButtonVariants } from "./button"; import { TextInput } from "./input"; import { PasswordComplexity } from "./password-complexity"; import { Spinner } from "./spinner"; +import { Translated } from "./translated"; type Inputs = | { @@ -207,7 +208,7 @@ export function SetPasswordForm({ }} data-testid="resend-button" > - {t("set.resend")} + @@ -279,8 +280,8 @@ export function SetPasswordForm({ onClick={handleSubmit(submitPassword)} data-testid="submit-button" > - {loading && } - {t("set.submit")} + {loading && }{" "} + diff --git a/apps/login/src/components/set-register-password-form.tsx b/apps/login/src/components/set-register-password-form.tsx index 3e48c649c1..715be00ffa 100644 --- a/apps/login/src/components/set-register-password-form.tsx +++ b/apps/login/src/components/set-register-password-form.tsx @@ -18,6 +18,7 @@ import { Button, ButtonVariants } from "./button"; import { TextInput } from "./input"; import { PasswordComplexity } from "./password-complexity"; import { Spinner } from "./spinner"; +import { Translated } from "./translated"; type Inputs = | { @@ -163,8 +164,8 @@ export function SetRegisterPasswordForm({ onClick={handleSubmit(submitRegister)} data-testid="submit-button" > - {loading && } - {t("password.submit")} + {loading && }{" "} +