mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-13 19:09:16 +00:00
i18n
This commit is contained in:
@@ -8,13 +8,12 @@ import { getServiceUrlFromHeaders } from "@/lib/service-url";
|
|||||||
import { loadMostRecentSession } from "@/lib/session";
|
import { loadMostRecentSession } from "@/lib/session";
|
||||||
import { getBrandingSettings, getUserByID } from "@/lib/zitadel";
|
import { getBrandingSettings, getUserByID } from "@/lib/zitadel";
|
||||||
import { HumanUser, User } from "@zitadel/proto/zitadel/user/v2/user_pb";
|
import { HumanUser, User } from "@zitadel/proto/zitadel/user/v2/user_pb";
|
||||||
import { getLocale, getTranslations } from "next-intl/server";
|
import { getLocale } from "next-intl/server";
|
||||||
import { headers } from "next/headers";
|
import { headers } from "next/headers";
|
||||||
|
|
||||||
export default async function Page(props: { searchParams: Promise<any> }) {
|
export default async function Page(props: { searchParams: Promise<any> }) {
|
||||||
const searchParams = await props.searchParams;
|
const searchParams = await props.searchParams;
|
||||||
const locale = getLocale();
|
const locale = getLocale();
|
||||||
const t = await getTranslations({ locale, namespace: "verify" });
|
|
||||||
|
|
||||||
const { userId, loginName, code, organization, requestId, invite, send } =
|
const { userId, loginName, code, organization, requestId, invite, send } =
|
||||||
searchParams;
|
searchParams;
|
||||||
@@ -121,25 +120,26 @@ export default async function Page(props: { searchParams: Promise<any> }) {
|
|||||||
return (
|
return (
|
||||||
<DynamicTheme branding={branding}>
|
<DynamicTheme branding={branding}>
|
||||||
<div className="flex flex-col items-center space-y-4">
|
<div className="flex flex-col items-center space-y-4">
|
||||||
<h1>{t("verify.title")}</h1>
|
<h1>
|
||||||
<p className="ztdl-p mb-6 block">{t("verify.description")}</p>
|
<Translated i18nKey="verify.title" namespace="verify" />
|
||||||
|
</h1>
|
||||||
|
<p className="ztdl-p mb-6 block">
|
||||||
|
<Translated i18nKey="verify.description" namespace="verify" />
|
||||||
|
</p>
|
||||||
|
|
||||||
{!id && (
|
{!id && (
|
||||||
<>
|
<div className="py-4">
|
||||||
<h1>{t("verify.title")}</h1>
|
<Alert>
|
||||||
<p className="ztdl-p mb-6 block">{t("verify.description")}</p>
|
<Translated i18nKey="unknownContext" namespace="error" />
|
||||||
|
</Alert>
|
||||||
<div className="py-4">
|
</div>
|
||||||
<Alert>
|
|
||||||
<Translated i18nKey="unknownContext" namespace="error" />
|
|
||||||
</Alert>
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{id && send && (
|
{id && send && (
|
||||||
<div className="py-4 w-full">
|
<div className="py-4 w-full">
|
||||||
<Alert type={AlertType.INFO}>{t("verify.codeSent")}</Alert>
|
<Alert type={AlertType.INFO}>
|
||||||
|
<Translated i18nKey="verify.codeSent" namespace="verify" />
|
||||||
|
</Alert>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
import { RegisterFormIDPIncomplete } from "@/components/register-form-idp-incomplete";
|
import { RegisterFormIDPIncomplete } from "@/components/register-form-idp-incomplete";
|
||||||
import { BrandingSettings } from "@zitadel/proto/zitadel/settings/v2/branding_settings_pb";
|
import { BrandingSettings } from "@zitadel/proto/zitadel/settings/v2/branding_settings_pb";
|
||||||
import { AddHumanUserRequest } from "@zitadel/proto/zitadel/user/v2/user_service_pb";
|
import { AddHumanUserRequest } from "@zitadel/proto/zitadel/user/v2/user_service_pb";
|
||||||
import { getLocale, getTranslations } from "next-intl/server";
|
|
||||||
import { DynamicTheme } from "../../dynamic-theme";
|
import { DynamicTheme } from "../../dynamic-theme";
|
||||||
|
import { Translated } from "../../translated";
|
||||||
|
|
||||||
export async function completeIDP({
|
export async function completeIDP({
|
||||||
idpUserId,
|
idpUserId,
|
||||||
@@ -26,14 +26,15 @@ export async function completeIDP({
|
|||||||
idpIntentToken: string;
|
idpIntentToken: string;
|
||||||
};
|
};
|
||||||
}) {
|
}) {
|
||||||
const locale = getLocale();
|
|
||||||
const t = await getTranslations({ locale, namespace: "idp" });
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DynamicTheme branding={branding}>
|
<DynamicTheme branding={branding}>
|
||||||
<div className="flex flex-col items-center space-y-4">
|
<div className="flex flex-col items-center space-y-4">
|
||||||
<h1>{t("completeRegister.title")}</h1>
|
<h1>
|
||||||
<p className="ztdl-p">{t("completeRegister.description")}</p>
|
<Translated i18nKey="completeRegister.title" namespace="idp" />
|
||||||
|
</h1>
|
||||||
|
<p className="ztdl-p">
|
||||||
|
<Translated i18nKey="completeRegister.description" namespace="idp" />
|
||||||
|
</p>
|
||||||
|
|
||||||
<RegisterFormIDPIncomplete
|
<RegisterFormIDPIncomplete
|
||||||
idpUserId={idpUserId}
|
idpUserId={idpUserId}
|
||||||
|
@@ -1,20 +1,21 @@
|
|||||||
import { BrandingSettings } from "@zitadel/proto/zitadel/settings/v2/branding_settings_pb";
|
import { BrandingSettings } from "@zitadel/proto/zitadel/settings/v2/branding_settings_pb";
|
||||||
import { getLocale, getTranslations } from "next-intl/server";
|
|
||||||
import { Alert, AlertType } from "../../alert";
|
import { Alert, AlertType } from "../../alert";
|
||||||
import { DynamicTheme } from "../../dynamic-theme";
|
import { DynamicTheme } from "../../dynamic-theme";
|
||||||
|
import { Translated } from "../../translated";
|
||||||
|
|
||||||
export async function linkingFailed(
|
export async function linkingFailed(
|
||||||
branding?: BrandingSettings,
|
branding?: BrandingSettings,
|
||||||
error?: string,
|
error?: string,
|
||||||
) {
|
) {
|
||||||
const locale = getLocale();
|
|
||||||
const t = await getTranslations({ locale, namespace: "idp" });
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DynamicTheme branding={branding}>
|
<DynamicTheme branding={branding}>
|
||||||
<div className="flex flex-col items-center space-y-4">
|
<div className="flex flex-col items-center space-y-4">
|
||||||
<h1>{t("linkingError.title")}</h1>
|
<h1>
|
||||||
<p className="ztdl-p">{t("linkingError.description")}</p>
|
<Translated i18nKey="linkingError.title" namespace="idp" />
|
||||||
|
</h1>
|
||||||
|
<p className="ztdl-p">
|
||||||
|
<Translated i18nKey="linkingError.description" namespace="idp" />
|
||||||
|
</p>
|
||||||
{error && (
|
{error && (
|
||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
{<Alert type={AlertType.ALERT}>{error}</Alert>}
|
{<Alert type={AlertType.ALERT}>{error}</Alert>}
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import { BrandingSettings } from "@zitadel/proto/zitadel/settings/v2/branding_settings_pb";
|
import { BrandingSettings } from "@zitadel/proto/zitadel/settings/v2/branding_settings_pb";
|
||||||
import { getLocale, getTranslations } from "next-intl/server";
|
|
||||||
import { DynamicTheme } from "../../dynamic-theme";
|
import { DynamicTheme } from "../../dynamic-theme";
|
||||||
import { IdpSignin } from "../../idp-signin";
|
import { IdpSignin } from "../../idp-signin";
|
||||||
|
import { Translated } from "../../translated";
|
||||||
|
|
||||||
export async function linkingSuccess(
|
export async function linkingSuccess(
|
||||||
userId: string,
|
userId: string,
|
||||||
@@ -9,14 +9,15 @@ export async function linkingSuccess(
|
|||||||
requestId?: string,
|
requestId?: string,
|
||||||
branding?: BrandingSettings,
|
branding?: BrandingSettings,
|
||||||
) {
|
) {
|
||||||
const locale = getLocale();
|
|
||||||
const t = await getTranslations({ locale, namespace: "idp" });
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DynamicTheme branding={branding}>
|
<DynamicTheme branding={branding}>
|
||||||
<div className="flex flex-col items-center space-y-4">
|
<div className="flex flex-col items-center space-y-4">
|
||||||
<h1>{t("linkingSuccess.title")}</h1>
|
<h1>
|
||||||
<p className="ztdl-p">{t("linkingSuccess.description")}</p>
|
<Translated i18nKey="linkingSuccess.title" namespace="idp" />
|
||||||
|
</h1>
|
||||||
|
<p className="ztdl-p">
|
||||||
|
<Translated i18nKey="linkingSuccess.description" namespace="idp" />
|
||||||
|
</p>
|
||||||
|
|
||||||
<IdpSignin
|
<IdpSignin
|
||||||
userId={userId}
|
userId={userId}
|
||||||
|
@@ -1,17 +1,18 @@
|
|||||||
import { BrandingSettings } from "@zitadel/proto/zitadel/settings/v2/branding_settings_pb";
|
import { BrandingSettings } from "@zitadel/proto/zitadel/settings/v2/branding_settings_pb";
|
||||||
import { getLocale, getTranslations } from "next-intl/server";
|
|
||||||
import { Alert, AlertType } from "../../alert";
|
import { Alert, AlertType } from "../../alert";
|
||||||
import { DynamicTheme } from "../../dynamic-theme";
|
import { DynamicTheme } from "../../dynamic-theme";
|
||||||
|
import { Translated } from "../../translated";
|
||||||
|
|
||||||
export async function loginFailed(branding?: BrandingSettings, error?: string) {
|
export async function loginFailed(branding?: BrandingSettings, error?: string) {
|
||||||
const locale = getLocale();
|
|
||||||
const t = await getTranslations({ locale, namespace: "idp" });
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DynamicTheme branding={branding}>
|
<DynamicTheme branding={branding}>
|
||||||
<div className="flex flex-col items-center space-y-4">
|
<div className="flex flex-col items-center space-y-4">
|
||||||
<h1>{t("loginError.title")}</h1>
|
<h1>
|
||||||
<p className="ztdl-p">{t("loginError.description")}</p>
|
<Translated i18nKey="loginError.title" namespace="idp" />
|
||||||
|
</h1>
|
||||||
|
<p className="ztdl-p">
|
||||||
|
<Translated i18nKey="loginError.description" namespace="idp" />
|
||||||
|
</p>
|
||||||
{error && (
|
{error && (
|
||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
{<Alert type={AlertType.ALERT}>{error}</Alert>}
|
{<Alert type={AlertType.ALERT}>{error}</Alert>}
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import { BrandingSettings } from "@zitadel/proto/zitadel/settings/v2/branding_settings_pb";
|
import { BrandingSettings } from "@zitadel/proto/zitadel/settings/v2/branding_settings_pb";
|
||||||
import { getLocale, getTranslations } from "next-intl/server";
|
|
||||||
import { DynamicTheme } from "../../dynamic-theme";
|
import { DynamicTheme } from "../../dynamic-theme";
|
||||||
import { IdpSignin } from "../../idp-signin";
|
import { IdpSignin } from "../../idp-signin";
|
||||||
|
import { Translated } from "../../translated";
|
||||||
|
|
||||||
export async function loginSuccess(
|
export async function loginSuccess(
|
||||||
userId: string,
|
userId: string,
|
||||||
@@ -9,14 +9,15 @@ export async function loginSuccess(
|
|||||||
requestId?: string,
|
requestId?: string,
|
||||||
branding?: BrandingSettings,
|
branding?: BrandingSettings,
|
||||||
) {
|
) {
|
||||||
const locale = getLocale();
|
|
||||||
const t = await getTranslations({ locale, namespace: "idp" });
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DynamicTheme branding={branding}>
|
<DynamicTheme branding={branding}>
|
||||||
<div className="flex flex-col items-center space-y-4">
|
<div className="flex flex-col items-center space-y-4">
|
||||||
<h1>{t("loginSuccess.title")}</h1>
|
<h1>
|
||||||
<p className="ztdl-p">{t("loginSuccess.description")}</p>
|
<Translated i18nKey="loginSuccess.title" namespace="idp" />
|
||||||
|
</h1>
|
||||||
|
<p className="ztdl-p">
|
||||||
|
<Translated i18nKey="loginSuccess.description" namespace="idp" />
|
||||||
|
</p>
|
||||||
|
|
||||||
<IdpSignin
|
<IdpSignin
|
||||||
userId={userId}
|
userId={userId}
|
||||||
|
@@ -4,7 +4,7 @@ import { clearSession } from "@/lib/server/session";
|
|||||||
import { timestampDate } from "@zitadel/client";
|
import { timestampDate } from "@zitadel/client";
|
||||||
import { Session } from "@zitadel/proto/zitadel/session/v2/session_pb";
|
import { Session } from "@zitadel/proto/zitadel/session/v2/session_pb";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import { useLocale, useTranslations } from "next-intl";
|
import { useLocale } from "next-intl";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { Avatar } from "./avatar";
|
import { Avatar } from "./avatar";
|
||||||
@@ -18,8 +18,6 @@ export function SessionClearItem({
|
|||||||
session: Session;
|
session: Session;
|
||||||
reload: () => void;
|
reload: () => void;
|
||||||
}) {
|
}) {
|
||||||
const t = useTranslations("logout");
|
|
||||||
|
|
||||||
const currentLocale = useLocale();
|
const currentLocale = useLocale();
|
||||||
moment.locale(currentLocale === "zh" ? "zh-cn" : currentLocale);
|
moment.locale(currentLocale === "zh" ? "zh-cn" : currentLocale);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user