idp translated

This commit is contained in:
Max Peintner
2025-06-19 14:55:16 +02:00
parent cccec6ea1e
commit 07f91f94b0
6 changed files with 40 additions and 18 deletions

View File

@@ -1,7 +1,7 @@
"use client"; "use client";
import { useTranslations } from "next-intl";
import { forwardRef } from "react"; import { forwardRef } from "react";
import { Translated } from "../translated";
import { BaseButton, SignInWithIdentityProviderProps } from "./base-button"; import { BaseButton, SignInWithIdentityProviderProps } from "./base-button";
export const SignInWithApple = forwardRef< export const SignInWithApple = forwardRef<
@@ -9,7 +9,6 @@ export const SignInWithApple = forwardRef<
SignInWithIdentityProviderProps SignInWithIdentityProviderProps
>(function SignInWithApple(props, ref) { >(function SignInWithApple(props, ref) {
const { children, name, ...restProps } = props; const { children, name, ...restProps } = props;
const t = useTranslations("idp");
return ( return (
<BaseButton {...restProps} ref={ref}> <BaseButton {...restProps} ref={ref}>
@@ -24,7 +23,13 @@ export const SignInWithApple = forwardRef<
{children ? ( {children ? (
children children
) : ( ) : (
<span className="ml-4">{name ? name : t("signInWithApple")}</span> <span className="ml-4">
{name ? (
name
) : (
<Translated i18nKey="signInWithApple" namespace="idp" />
)}
</span>
)} )}
</BaseButton> </BaseButton>
); );

View File

@@ -1,7 +1,7 @@
"use client"; "use client";
import { useTranslations } from "next-intl";
import { forwardRef } from "react"; import { forwardRef } from "react";
import { Translated } from "../translated";
import { BaseButton, SignInWithIdentityProviderProps } from "./base-button"; import { BaseButton, SignInWithIdentityProviderProps } from "./base-button";
export const SignInWithAzureAd = forwardRef< export const SignInWithAzureAd = forwardRef<
@@ -9,7 +9,6 @@ export const SignInWithAzureAd = forwardRef<
SignInWithIdentityProviderProps SignInWithIdentityProviderProps
>(function SignInWithAzureAd(props, ref) { >(function SignInWithAzureAd(props, ref) {
const { children, name, ...restProps } = props; const { children, name, ...restProps } = props;
const t = useTranslations("idp");
return ( return (
<BaseButton {...restProps} ref={ref}> <BaseButton {...restProps} ref={ref}>
@@ -30,7 +29,13 @@ export const SignInWithAzureAd = forwardRef<
{children ? ( {children ? (
children children
) : ( ) : (
<span className="ml-4">{name ? name : t("signInWithAzureAD")}</span> <span className="ml-4">
{name ? (
name
) : (
<Translated i18nKey="signInWithAzureAD" namespace="idp" />
)}
</span>
)} )}
</BaseButton> </BaseButton>
); );

View File

@@ -1,7 +1,7 @@
"use client"; "use client";
import { useTranslations } from "next-intl";
import { forwardRef } from "react"; import { forwardRef } from "react";
import { Translated } from "../translated";
import { BaseButton, SignInWithIdentityProviderProps } from "./base-button"; import { BaseButton, SignInWithIdentityProviderProps } from "./base-button";
function GitHubLogo() { function GitHubLogo() {
@@ -42,7 +42,6 @@ export const SignInWithGithub = forwardRef<
SignInWithIdentityProviderProps SignInWithIdentityProviderProps
>(function SignInWithGithub(props, ref) { >(function SignInWithGithub(props, ref) {
const { children, name, ...restProps } = props; const { children, name, ...restProps } = props;
const t = useTranslations("idp");
return ( return (
<BaseButton {...restProps} ref={ref}> <BaseButton {...restProps} ref={ref}>
@@ -52,7 +51,13 @@ export const SignInWithGithub = forwardRef<
{children ? ( {children ? (
children children
) : ( ) : (
<span className="ml-4">{name ? name : t("signInWithGithub")}</span> <span className="ml-4">
{name ? (
name
) : (
<Translated i18nKey="signInWithGithub" namespace="idp" />
)}
</span>
)} )}
</BaseButton> </BaseButton>
); );

View File

@@ -1,7 +1,7 @@
"use client"; "use client";
import { useTranslations } from "next-intl";
import { forwardRef } from "react"; import { forwardRef } from "react";
import { Translated } from "../translated";
import { BaseButton, SignInWithIdentityProviderProps } from "./base-button"; import { BaseButton, SignInWithIdentityProviderProps } from "./base-button";
export const SignInWithGitlab = forwardRef< export const SignInWithGitlab = forwardRef<
@@ -9,7 +9,6 @@ export const SignInWithGitlab = forwardRef<
SignInWithIdentityProviderProps SignInWithIdentityProviderProps
>(function SignInWithGitlab(props, ref) { >(function SignInWithGitlab(props, ref) {
const { children, name, ...restProps } = props; const { children, name, ...restProps } = props;
const t = useTranslations("idp");
return ( return (
<BaseButton {...restProps} ref={ref}> <BaseButton {...restProps} ref={ref}>
@@ -41,7 +40,13 @@ export const SignInWithGitlab = forwardRef<
{children ? ( {children ? (
children children
) : ( ) : (
<span className="ml-4">{name ? name : t("signInWithGitlab")}</span> <span className="ml-4">
{name ? (
name
) : (
<Translated i18nKey="signInWithGitlab" namespace="idp" />
)}
</span>
)} )}
</BaseButton> </BaseButton>
); );

View File

@@ -1,7 +1,7 @@
"use client"; "use client";
import { useTranslations } from "next-intl";
import { forwardRef } from "react"; import { forwardRef } from "react";
import { Translated } from "../translated";
import { BaseButton, SignInWithIdentityProviderProps } from "./base-button"; import { BaseButton, SignInWithIdentityProviderProps } from "./base-button";
export const SignInWithGoogle = forwardRef< export const SignInWithGoogle = forwardRef<
@@ -9,7 +9,6 @@ export const SignInWithGoogle = forwardRef<
SignInWithIdentityProviderProps SignInWithIdentityProviderProps
>(function SignInWithGoogle(props, ref) { >(function SignInWithGoogle(props, ref) {
const { children, name, ...restProps } = props; const { children, name, ...restProps } = props;
const t = useTranslations("idp");
return ( return (
<BaseButton {...restProps} ref={ref}> <BaseButton {...restProps} ref={ref}>
@@ -54,7 +53,13 @@ export const SignInWithGoogle = forwardRef<
{children ? ( {children ? (
children children
) : ( ) : (
<span className="ml-4">{name ? name : t("signInWithGoogle")}</span> <span className="ml-4">
{name ? (
name
) : (
<Translated i18nKey="signInWithGoogle" namespace="idp" />
)}
</span>
)} )}
</BaseButton> </BaseButton>
); );

View File

@@ -8,7 +8,6 @@ import {
} from "@/helpers/validators"; } from "@/helpers/validators";
import { registerUser } from "@/lib/server/register"; import { registerUser } from "@/lib/server/register";
import { PasswordComplexitySettings } from "@zitadel/proto/zitadel/settings/v2/password_settings_pb"; import { PasswordComplexitySettings } from "@zitadel/proto/zitadel/settings/v2/password_settings_pb";
import { useTranslations } from "next-intl";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { useState } from "react"; import { useState } from "react";
import { FieldValues, useForm } from "react-hook-form"; import { FieldValues, useForm } from "react-hook-form";
@@ -44,8 +43,6 @@ export function SetRegisterPasswordForm({
organization, organization,
requestId, requestId,
}: Props) { }: Props) {
const t = useTranslations("register");
const { register, handleSubmit, watch, formState } = useForm<Inputs>({ const { register, handleSubmit, watch, formState } = useForm<Inputs>({
mode: "onBlur", mode: "onBlur",
defaultValues: { defaultValues: {