feat: i18n for other blocks and filter blocks

This commit is contained in:
gchust 2025-06-28 16:53:59 +08:00
parent 02081d189d
commit b2bc7f1573
6 changed files with 19 additions and 12 deletions

View File

@ -13,6 +13,7 @@ import { FormProvider } from '@formily/react';
import { AddActionButton, AddFieldButton, Collection, FlowModelRenderer } from '@nocobase/flow-engine';
import { Card } from 'antd';
import React from 'react';
import { tval } from '@nocobase/utils/client';
import { FilterBlockModel } from '../../base/BlockModel';
import { FilterFormFieldModel } from './FilterFormFieldModel';
@ -69,7 +70,7 @@ export class FilterFormModel extends FilterBlockModel {
FilterFormModel.define({
hide: true,
title: 'Form',
title: tval('Form'),
});
FilterFormModel.registerFlow({
@ -82,20 +83,20 @@ FilterFormModel.registerFlow({
uiSchema: {
dataSourceKey: {
type: 'string',
title: 'Data Source Key',
title: tval('Data Source Key'),
'x-decorator': 'FormItem',
'x-component': 'Input',
'x-component-props': {
placeholder: 'Enter data source key',
placeholder: tval('Enter data source key'),
},
},
collectionName: {
type: 'string',
title: 'Collection Name',
title: tval('Collection Name'),
'x-decorator': 'FormItem',
'x-component': 'Input',
'x-component-props': {
placeholder: 'Enter collection name',
placeholder: tval('Enter collection name'),
},
},
},

View File

@ -9,12 +9,13 @@
import { FlowEngine, MultiRecordResource } from '@nocobase/flow-engine';
import { ButtonProps } from 'antd';
import { tval } from '@nocobase/utils/client';
import { DataBlockModel } from '../../base/BlockModel';
import { FilterFormActionModel } from './FilterFormActionModel';
export class FilterFormResetActionModel extends FilterFormActionModel {
defaultProps: ButtonProps = {
children: 'Reset',
children: tval('Reset'),
};
}
@ -27,7 +28,7 @@ FilterFormResetActionModel.registerFlow({
step1: {
async handler(ctx, params) {
if (!ctx.shared?.currentBlockModel?.form) {
ctx.globals.message.error('No form available for reset.');
ctx.globals.message.error(ctx.globals.flowEngine.translate('No form available for reset.'));
return;
}
const currentBlockModel = ctx.shared.currentBlockModel;

View File

@ -9,13 +9,14 @@
import { FlowEngine, MultiRecordResource } from '@nocobase/flow-engine';
import type { ButtonProps, ButtonType } from 'antd/es/button';
import { tval } from '@nocobase/utils/client';
import { ActionModel } from '../../base/ActionModel';
import { DataBlockModel } from '../../base/BlockModel';
import { FilterFormActionModel } from './FilterFormActionModel';
export class FilterFormSubmitActionModel extends FilterFormActionModel {
defaultProps: ButtonProps = {
children: 'Filter',
children: tval('Filter'),
type: 'primary',
};
}
@ -29,7 +30,7 @@ FilterFormSubmitActionModel.registerFlow({
step1: {
async handler(ctx, params) {
if (!ctx.shared?.currentBlockModel?.form) {
ctx.globals.message.error('No form available for submission.');
ctx.globals.message.error(ctx.globals.flowEngine.translate('No form available for submission.'));
return;
}
const currentBlockModel = ctx.shared.currentBlockModel;

View File

@ -36,7 +36,7 @@ export class HtmlBlockModel extends BlockModel {
HtmlBlockModel.define({
title: tval('HTML'),
group: 'Content',
group: tval('Content'),
hide: true,
defaultOptions: {
use: 'HtmlBlockModel',

View File

@ -975,5 +975,7 @@
"Placeholder": "Placeholder",
"Enter placeholder text": "Enter placeholder text",
"Check strength": "Check strength",
"N/A": "N/A"
"N/A": "N/A",
"No form available for reset.": "No form available for reset.",
"No form available for submission.": "No form available for submission."
}

View File

@ -1208,5 +1208,7 @@
"Placeholder": "占位符",
"Enter placeholder text": "输入占位符文本",
"Check strength": "检查强度",
"N/A": "不适用"
"N/A": "不适用",
"No form available for reset.": "没有可用的表单进行重置。",
"No form available for submission.": "没有可用的表单进行提交。"
}