From 27c2538d40878d3a110b98de133c2fe7722a2ed2 Mon Sep 17 00:00:00 2001 From: YANG QIA <2013xile@gmail.com> Date: Wed, 26 Mar 2025 11:02:00 +0800 Subject: [PATCH] fix(l10n): localization for fields of sign up page (#6556) --- .../plugin-auth/src/client/basic/SignUpForm.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/plugins/@nocobase/plugin-auth/src/client/basic/SignUpForm.tsx b/packages/plugins/@nocobase/plugin-auth/src/client/basic/SignUpForm.tsx index ac01ea81c7..1f1470a9cf 100644 --- a/packages/plugins/@nocobase/plugin-auth/src/client/basic/SignUpForm.tsx +++ b/packages/plugins/@nocobase/plugin-auth/src/client/basic/SignUpForm.tsx @@ -8,7 +8,7 @@ */ import { SchemaComponent } from '@nocobase/client'; -import { ISchema } from '@formily/react'; +import { ISchema, Schema } from '@formily/react'; import React, { useMemo } from 'react'; import { uid } from '@formily/shared'; import { useAuthTranslation } from '../locale'; @@ -122,6 +122,7 @@ const getSignupPageSchema = (fieldSchemas: any): ISchema => ({ export const SignUpForm = ({ authenticatorName: name }: { authenticatorName: string }) => { const { t } = useAuthTranslation(); + const { t: fieldT } = useTranslation('lm-collections'); const useBasicSignUp = () => { return useSignUp({ authenticator: name }); }; @@ -132,8 +133,12 @@ export const SignUpForm = ({ authenticatorName: name }: { authenticatorName: str return signupForm .filter((field: { show: boolean }) => field.show) .reduce((prev: any, item: { field: string; required: boolean; uiSchema: any }) => { - prev[item.field] = { + const uiSchema = { ...item.uiSchema, + title: item.uiSchema.title ? fieldT(Schema.compile(item.uiSchema.title, { t })) : '', + }; + prev[item.field] = { + ...uiSchema, required: item.required, 'x-decorator': 'FormItem', };