diff --git a/packages/app/client/src/pages/document.ejs b/packages/app/client/src/pages/document.ejs
index 3079f0952..3a0e17461 100644
--- a/packages/app/client/src/pages/document.ejs
+++ b/packages/app/client/src/pages/document.ejs
@@ -2,7 +2,7 @@
- Your App
+ Loading...
diff --git a/packages/core/client/src/acl/Configuration/MenuConfigure.tsx b/packages/core/client/src/acl/Configuration/MenuConfigure.tsx
index 64f691dac..cd091dd14 100644
--- a/packages/core/client/src/acl/Configuration/MenuConfigure.tsx
+++ b/packages/core/client/src/acl/Configuration/MenuConfigure.tsx
@@ -1,7 +1,9 @@
import { Checkbox, message, Table } from 'antd';
import React, { useState } from 'react';
+import { useTranslation } from 'react-i18next';
import { useAPIClient, useRequest } from '../../api-client';
import { useRecord } from '../../record-provider';
+import { useCompile } from '../../schema-component';
import { useMenuItems } from './RoleTable';
const findUids = (items) => {
@@ -20,6 +22,8 @@ export const MenuConfigure = () => {
const record = useRecord();
const api = useAPIClient();
const items = useMenuItems();
+ const compile = useCompile();
+ const { t } = useTranslation();
const allUids = findUids(items);
const [uids, setUids] = useState([]);
const { loading, refresh } = useRequest(
@@ -50,7 +54,7 @@ export const MenuConfigure = () => {
columns={[
{
dataIndex: 'title',
- title: '菜单项',
+ title: t('Menu item title'),
},
{
dataIndex: 'accessible',
@@ -69,10 +73,10 @@ export const MenuConfigure = () => {
});
}
refresh();
- message.success('保存成功');
+ message.success(t('Saved successfully'));
}}
/>{' '}
- 允许访问
+ {t('Accessible')}
>
),
render: (_, schema) => {
@@ -93,7 +97,7 @@ export const MenuConfigure = () => {
tk: schema.uid,
},
});
- message.success('保存成功');
+ message.success(t('Saved successfully'));
}}
/>
);
diff --git a/packages/core/client/src/acl/Configuration/RolesResourcesActions.tsx b/packages/core/client/src/acl/Configuration/RolesResourcesActions.tsx
index af1681e7e..5c42a93f5 100644
--- a/packages/core/client/src/acl/Configuration/RolesResourcesActions.tsx
+++ b/packages/core/client/src/acl/Configuration/RolesResourcesActions.tsx
@@ -85,14 +85,14 @@ export const RolesResourcesActions = connect((props) => {
-
+
compile(value),
},
{
@@ -148,14 +148,14 @@ export const RolesResourcesActions = connect((props) => {
})}
/>
-
+
compile(value),
},
...availableActionsWithFields.map((action) => {
diff --git a/packages/core/client/src/acl/Configuration/schemas/roleCollections.ts b/packages/core/client/src/acl/Configuration/schemas/roleCollections.ts
index b2d584d90..85186613c 100644
--- a/packages/core/client/src/acl/Configuration/schemas/roleCollections.ts
+++ b/packages/core/client/src/acl/Configuration/schemas/roleCollections.ts
@@ -12,34 +12,34 @@ const collection = {
name: 'title',
interface: 'input',
uiSchema: {
- title: '数据表名称',
+ title: '{{t("Collection display name")}}',
type: 'number',
'x-component': 'Input',
required: true,
} as ISchema,
},
- {
- type: 'string',
- name: 'name',
- interface: 'input',
- uiSchema: {
- title: '数据表标识',
- type: 'string',
- 'x-component': 'Input',
- description: '使用英文',
- } as ISchema,
- },
+ // {
+ // type: 'string',
+ // name: 'name',
+ // interface: 'input',
+ // uiSchema: {
+ // title: '数据表标识',
+ // type: 'string',
+ // 'x-component': 'Input',
+ // description: '使用英文',
+ // } as ISchema,
+ // },
{
type: 'string',
name: 'usingConfig',
interface: 'input',
uiSchema: {
- title: '权限策略',
+ title: '{{t("Permission policy")}}',
type: 'string',
'x-component': 'Select',
enum: [
- { label: '单独配置', value: 'resourceAction', color: 'orange' },
- { label: '通用配置', value: 'strategy', color: 'default' },
+ { label: '{{t("Individual")}}', value: 'resourceAction', color: 'orange' },
+ { label: '{{t("General")}}', value: 'strategy', color: 'default' },
],
} as ISchema,
},
@@ -127,7 +127,7 @@ export const roleCollectionsSchema: ISchema = {
},
column4: {
type: 'void',
- title: 'Actions',
+ title: '{{t("Actions")}}',
'x-component': 'Table.Column',
properties: {
actions: {
@@ -139,7 +139,7 @@ export const roleCollectionsSchema: ISchema = {
properties: {
configure: {
type: 'void',
- title: '单独配置权限',
+ title: '{{t("Configure")}}',
'x-component': 'Action.Link',
'x-component-props': {
type: 'primary',
@@ -152,15 +152,16 @@ export const roleCollectionsSchema: ISchema = {
'x-decorator-props': {
useValues: useRoleResourceValues,
},
- title: '配置权限',
+ title: '{{t("Configure permission")}}',
properties: {
usingActionsConfig: {
+ title: '{{t("Permission policy")}}',
'x-component': 'Radio.Group',
'x-decorator': 'FormItem',
default: false,
enum: [
- { value: false, label: '使用通用权限' },
- { value: true, label: '单独配置权限' },
+ { value: false, label: '{{t("General")}}' },
+ { value: true, label: '{{t("Individual")}}' },
],
'x-reactions': {
target: 'actions',
@@ -179,15 +180,15 @@ export const roleCollectionsSchema: ISchema = {
type: 'void',
'x-component': 'Action.Drawer.Footer',
properties: {
- action1: {
- title: 'Cancel',
+ cancel: {
+ title: '{{t("Cancel")}}',
'x-component': 'Action',
'x-component-props': {
useAction: '{{ cm.useCancelAction }}',
},
},
- action2: {
- title: 'Submit',
+ submit: {
+ title: '{{t("Submit")}}',
'x-component': 'Action',
'x-component-props': {
type: 'primary',
diff --git a/packages/core/client/src/acl/Configuration/schemas/roles.ts b/packages/core/client/src/acl/Configuration/schemas/roles.ts
index ba4ffd2e1..d74a1e3f1 100644
--- a/packages/core/client/src/acl/Configuration/schemas/roles.ts
+++ b/packages/core/client/src/acl/Configuration/schemas/roles.ts
@@ -14,7 +14,7 @@ const collection = {
name: 'title',
interface: 'input',
uiSchema: {
- title: '角色名称',
+ title: '{{t("Role title")}}',
type: 'number',
'x-component': 'Input',
required: true,
@@ -25,7 +25,7 @@ const collection = {
name: 'name',
interface: 'input',
uiSchema: {
- title: '角色标识',
+ title: '{{t("Role name")}}',
type: 'string',
'x-component': 'Input',
} as ISchema,
@@ -35,7 +35,7 @@ const collection = {
name: 'default',
interface: 'boolean',
uiSchema: {
- title: '默认角色',
+ title: '{{t("Default role")}}',
type: 'boolean',
'x-component': 'Checkbox',
} as ISchema,
@@ -82,12 +82,19 @@ export const roleSchema: ISchema = {
properties: {
delete: {
type: 'void',
- title: '删除',
+ title: '{{ t("Delete") }}',
'x-component': 'Action',
+ 'x-component-props': {
+ useAction: '{{ cm.useBulkDestroyAction }}',
+ confirm: {
+ title: "{{t('Delete role')}}",
+ content: "{{t('Are you sure you want to delete it?')}}",
+ },
+ },
},
create: {
type: 'void',
- title: '添加角色',
+ title: '{{t("Add role")}}',
'x-component': 'Action',
'x-component-props': {
type: 'primary',
@@ -111,7 +118,7 @@ export const roleSchema: ISchema = {
);
},
},
- title: '添加角色',
+ title: '{{t("Add role")}}',
properties: {
title: {
'x-component': 'CollectionField',
@@ -120,25 +127,28 @@ export const roleSchema: ISchema = {
name: {
'x-component': 'CollectionField',
'x-decorator': 'FormItem',
- description: '{{t("Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.")}}',
+ description:
+ '{{t("Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.")}}',
},
default: {
'x-component': 'CollectionField',
'x-decorator': 'FormItem',
+ title: '',
+ 'x-content': '{{t("Default role")}}',
},
footer: {
type: 'void',
'x-component': 'Action.Drawer.Footer',
properties: {
- action1: {
- title: 'Cancel',
+ cancel: {
+ title: '{{t("Cancel")}}',
'x-component': 'Action',
'x-component-props': {
useAction: '{{ cm.useCancelAction }}',
},
},
- action2: {
- title: 'Submit',
+ submit: {
+ title: '{{t("Submit")}}',
'x-component': 'Action',
'x-component-props': {
type: 'primary',
@@ -215,14 +225,14 @@ export const roleSchema: ISchema = {
properties: {
view: {
type: 'void',
- title: '配置权限',
+ title: '{{t("Configure")}}',
'x-component': 'Action.Link',
'x-component-props': {},
properties: {
drawer: {
type: 'void',
'x-component': 'Action.Drawer',
- title: '配置权限',
+ title: '{{t("Configure permissions")}}',
properties: {
tabs1: {
type: 'void',
@@ -231,7 +241,7 @@ export const roleSchema: ISchema = {
properties: {
tab1: {
type: 'void',
- title: '系统全局配置',
+ title: '{{t("Global permissions")}}',
'x-component': 'Tabs.TabPane',
'x-component-props': {},
properties: {
@@ -242,7 +252,7 @@ export const roleSchema: ISchema = {
},
tab2: {
type: 'void',
- title: '数据权限',
+ title: '{{t("Action permissions")}}',
'x-component': 'Tabs.TabPane',
'x-component-props': {},
properties: {
@@ -251,7 +261,7 @@ export const roleSchema: ISchema = {
},
tab3: {
type: 'void',
- title: '菜单访问权限',
+ title: '{{t("Menu permissions")}}',
'x-component': 'Tabs.TabPane',
'x-component-props': {},
properties: {
@@ -268,7 +278,7 @@ export const roleSchema: ISchema = {
},
update: {
type: 'void',
- title: '编辑',
+ title: '{{t("Edit")}}',
'x-component': 'Action.Link',
'x-component-props': {
type: 'primary',
@@ -281,7 +291,7 @@ export const roleSchema: ISchema = {
'x-decorator-props': {
useValues: '{{ cm.useValuesFromRecord }}',
},
- title: '编辑角色',
+ title: '{{t("Edit role")}}',
properties: {
title: {
'x-component': 'CollectionField',
@@ -293,22 +303,24 @@ export const roleSchema: ISchema = {
'x-disabled': true,
},
default: {
+ title: '',
'x-component': 'CollectionField',
'x-decorator': 'FormItem',
+ 'x-content': '{{t("Default role")}}',
},
footer: {
type: 'void',
'x-component': 'Action.Drawer.Footer',
properties: {
- action1: {
- title: 'Cancel',
+ cancel: {
+ title: '{{t("Cancel")}}',
'x-component': 'Action',
'x-component-props': {
useAction: '{{ cm.useCancelAction }}',
},
},
- action2: {
- title: 'Submit',
+ submit: {
+ title: '{{t("Submit")}}',
'x-component': 'Action',
'x-component-props': {
type: 'primary',
@@ -323,10 +335,14 @@ export const roleSchema: ISchema = {
},
delete: {
type: 'void',
- title: '删除',
+ title: '{{ t("Delete") }}',
'x-component': 'Action.Link',
'x-component-props': {
- useAction: '{{ cm.useDestroyAction }}',
+ confirm: {
+ title: "{{t('Delete role')}}",
+ content: "{{t('Are you sure you want to delete it?')}}",
+ },
+ useAction: '{{cm.useDestroyAction}}',
},
},
},
diff --git a/packages/core/client/src/acl/Configuration/schemas/scopes.ts b/packages/core/client/src/acl/Configuration/schemas/scopes.ts
index f1c1d5439..291f4ac48 100644
--- a/packages/core/client/src/acl/Configuration/schemas/scopes.ts
+++ b/packages/core/client/src/acl/Configuration/schemas/scopes.ts
@@ -12,7 +12,7 @@ export const rolesResourcesScopesCollection = {
name: 'name',
interface: 'input',
uiSchema: {
- title: '名称',
+ title: '{{t("Scope name")}}',
type: 'string',
'x-component': 'Input',
required: true,
diff --git a/packages/core/client/src/block-provider/hooks/index.ts b/packages/core/client/src/block-provider/hooks/index.ts
index 16d588e85..6eea72324 100644
--- a/packages/core/client/src/block-provider/hooks/index.ts
+++ b/packages/core/client/src/block-provider/hooks/index.ts
@@ -3,7 +3,7 @@ import { Modal } from 'antd';
import { useTranslation } from 'react-i18next';
import { useHistory } from 'react-router-dom';
import { useCollection } from '../../collection-manager';
-import { useActionContext } from '../../schema-component';
+import { useActionContext, useCompile } from '../../schema-component';
import { useBlockRequestContext, useFilterByTk } from '../BlockProvider';
import { useDetailsBlockContext } from '../DetailsBlockProvider';
import { TableFieldResource } from '../TableFieldProvider';
@@ -60,6 +60,7 @@ export const useCreateActionProps = () => {
const { t } = useTranslation();
const actionSchema = useFieldSchema();
const { fields, getField } = useCollection();
+ const compile = useCompile();
return {
async onClick() {
const fieldNames = fields.map((field) => field.name);
@@ -112,7 +113,7 @@ export const useCreateActionProps = () => {
return;
}
Modal.success({
- title: onSuccess?.successMessage,
+ title: compile(onSuccess?.successMessage),
onOk: async () => {
await form.reset();
if (onSuccess?.redirecting && onSuccess?.redirectTo) {
@@ -136,6 +137,7 @@ export const useUpdateActionProps = () => {
const actionSchema = useFieldSchema();
const history = useHistory();
const { fields, getField } = useCollection();
+ const compile = useCompile();
return {
async onClick() {
const skipValidator = actionSchema?.['x-action-settings']?.skipValidator;
@@ -197,7 +199,7 @@ export const useUpdateActionProps = () => {
const onSuccess = actionSchema?.['x-action-settings']?.onSuccess;
if (onSuccess?.successMessage) {
Modal.success({
- title: onSuccess?.successMessage,
+ title: compile(onSuccess?.successMessage),
onOk: async () => {
await form.reset();
if (onSuccess?.redirecting && onSuccess?.redirectTo) {
diff --git a/packages/core/client/src/collection-manager/interfaces/chinaRegion.ts b/packages/core/client/src/collection-manager/interfaces/chinaRegion.ts
index 72086321d..c6e35b956 100644
--- a/packages/core/client/src/collection-manager/interfaces/chinaRegion.ts
+++ b/packages/core/client/src/collection-manager/interfaces/chinaRegion.ts
@@ -78,10 +78,10 @@ export const chinaRegion: IField = {
children: [
{
name: 'name',
- title: '名称',
+ title: '{{t("Filename")}}',
operators: operators.string,
schema: {
- title: '名称',
+ title: '{{t("Filename")}}',
type: 'string',
'x-component': 'Input',
},
diff --git a/packages/core/client/src/locale/zh_CN.ts b/packages/core/client/src/locale/zh_CN.ts
index 29b8f933b..47f672c0c 100644
--- a/packages/core/client/src/locale/zh_CN.ts
+++ b/packages/core/client/src/locale/zh_CN.ts
@@ -288,5 +288,8 @@ export default {
"Block type": "区块类型",
"Action column": "操作列",
"Records per page": "每页显示数量",
- "(Fields only)": "(仅字段)"
+ "(Fields only)": "(仅字段)",
+ "Button title": "按钮标题",
+ "Button icon": "按钮图标",
+ "Submitted successfully": "提交成功",
}
diff --git a/packages/core/client/src/schema-component/antd/action/Action.Designer.tsx b/packages/core/client/src/schema-component/antd/action/Action.Designer.tsx
index 390bdb299..1d3b74579 100644
--- a/packages/core/client/src/schema-component/antd/action/Action.Designer.tsx
+++ b/packages/core/client/src/schema-component/antd/action/Action.Designer.tsx
@@ -13,16 +13,16 @@ export const ActionDesigner = (props) => {
return (
{
icon: {
'x-decorator': 'FormItem',
'x-component': 'IconPicker',
- title: '按钮图标',
+ title: t('Button icon'),
default: fieldSchema?.['x-component-props']?.icon,
'x-component-props': {},
// description: `原字段标题:${collectionField?.uiSchema?.title}`,
@@ -60,10 +60,10 @@ export const ActionDesigner = (props) => {
/>
{isPopupAction && (
{
@@ -81,7 +81,7 @@ export const ActionDesigner = (props) => {
)}
{fieldSchema?.['x-action-settings'] && (
{
fieldSchema['x-action-settings'].skipValidator = value;
@@ -98,13 +98,13 @@ export const ActionDesigner = (props) => {
)}
{fieldSchema?.['x-action-settings'] && (
{
breakRemoveOn={(s) => {
return s['x-component'] === 'Space' || s['x-component'].endsWith('ActionBar');
}}
+ confirm={{
+ title: t('Delete action')
+ }}
/>
);
diff --git a/packages/core/client/src/schema-component/antd/block-item/BlockItem.tsx b/packages/core/client/src/schema-component/antd/block-item/BlockItem.tsx
index 09e40b35d..413d02fb0 100644
--- a/packages/core/client/src/schema-component/antd/block-item/BlockItem.tsx
+++ b/packages/core/client/src/schema-component/antd/block-item/BlockItem.tsx
@@ -13,7 +13,6 @@ export const BlockItem: React.FC = (props) => {
props.className,
css`
position: relative;
- overflow: hidden;
&:hover {
> .general-schema-designer {
display: block;
diff --git a/packages/core/client/src/schema-component/antd/filter/Filter.Action.Designer.tsx b/packages/core/client/src/schema-component/antd/filter/Filter.Action.Designer.tsx
index 049d6c78d..12dd581fa 100644
--- a/packages/core/client/src/schema-component/antd/filter/Filter.Action.Designer.tsx
+++ b/packages/core/client/src/schema-component/antd/filter/Filter.Action.Designer.tsx
@@ -65,27 +65,25 @@ export const FilterActionDesigner = (props) => {
{
)}
{collectionField?.target && (
{
@@ -201,6 +201,9 @@ FormItem.Designer = () => {
{collectionField && }
{
return;
}
const dn = createDesignable({
+ t,
api,
refresh,
current: gridSchema,
diff --git a/packages/core/client/src/schema-component/antd/kanban/Kanban.Card.Designer.tsx b/packages/core/client/src/schema-component/antd/kanban/Kanban.Card.Designer.tsx
index f41096e76..36a0fb986 100644
--- a/packages/core/client/src/schema-component/antd/kanban/Kanban.Card.Designer.tsx
+++ b/packages/core/client/src/schema-component/antd/kanban/Kanban.Card.Designer.tsx
@@ -79,6 +79,7 @@ export const KanbanCardDesigner = (props: any) => {
return;
}
const dn = createDesignable({
+ t,
api,
refresh,
current: gridSchema,
diff --git a/packages/core/client/src/schema-component/antd/markdown/Markdown.Void.Designer.tsx b/packages/core/client/src/schema-component/antd/markdown/Markdown.Void.Designer.tsx
index 0ace6166b..e37eb6244 100644
--- a/packages/core/client/src/schema-component/antd/markdown/Markdown.Void.Designer.tsx
+++ b/packages/core/client/src/schema-component/antd/markdown/Markdown.Void.Designer.tsx
@@ -1,13 +1,15 @@
import { useField } from '@formily/react';
import React from 'react';
+import { useTranslation } from 'react-i18next';
import { GeneralSchemaDesigner, SchemaSettings } from '../../../schema-settings';
export const MarkdownVoidDesigner = () => {
const field = useField();
+ const { t } = useTranslation();
return (
{
field.editable = true;
}}
diff --git a/packages/core/client/src/schema-component/antd/menu/Menu.Designer.tsx b/packages/core/client/src/schema-component/antd/menu/Menu.Designer.tsx
index 6868fce66..1bedf0c2c 100644
--- a/packages/core/client/src/schema-component/antd/menu/Menu.Designer.tsx
+++ b/packages/core/client/src/schema-component/antd/menu/Menu.Designer.tsx
@@ -308,6 +308,7 @@ export const MenuDesigner = () => {
}
const current = findByUid(menuSchema, uid);
const dn = createDesignable({
+ t,
api,
refresh,
current,
diff --git a/packages/core/client/src/schema-component/antd/menu/Menu.tsx b/packages/core/client/src/schema-component/antd/menu/Menu.tsx
index 612eb859c..7bc717422 100644
--- a/packages/core/client/src/schema-component/antd/menu/Menu.tsx
+++ b/packages/core/client/src/schema-component/antd/menu/Menu.tsx
@@ -10,6 +10,7 @@ import {
import { Menu as AntdMenu } from 'antd';
import React, { createContext, useContext, useEffect, useState } from 'react';
import { createPortal } from 'react-dom';
+import { useTranslation } from 'react-i18next';
import { createDesignable, DndContext, SortableItem, useDesignable, useDesigner } from '../..';
import { Icon, useAPIClient, useSchemaInitializer } from '../../../';
import { MenuDesigner } from './Menu.Designer';
@@ -144,6 +145,7 @@ export const Menu: ComposedMenu = observer((props) => {
defaultOpenKeys: dOpenKeys,
...others
} = props;
+ const { t } = useTranslation();
const Designer = useDesigner();
const schema = useFieldSchema();
const { refresh } = useDesignable();
@@ -300,8 +302,8 @@ export const Menu: ComposedMenu = observer((props) => {
{render({
style: { margin: 8 },
insert: (s) => {
- console.log('createDesignable', s);
const dn = createDesignable({
+ t,
api,
refresh,
current: sideMenuSchema,
diff --git a/packages/core/client/src/schema-component/antd/table-v2/Table.Column.Designer.tsx b/packages/core/client/src/schema-component/antd/table-v2/Table.Column.Designer.tsx
index bf71f620c..93044677e 100644
--- a/packages/core/client/src/schema-component/antd/table-v2/Table.Column.Designer.tsx
+++ b/packages/core/client/src/schema-component/antd/table-v2/Table.Column.Designer.tsx
@@ -34,16 +34,16 @@ export const TableColumnDesigner = (props) => {
return (
{
breakRemoveOn={{
'x-component': 'Grid',
}}
+ confirm={{
+ title: t('Delete table column')
+ }}
/>
);
diff --git a/packages/core/client/src/schema-component/common/dnd-context/index.tsx b/packages/core/client/src/schema-component/common/dnd-context/index.tsx
index db01575a4..9fe07dfc3 100644
--- a/packages/core/client/src/schema-component/common/dnd-context/index.tsx
+++ b/packages/core/client/src/schema-component/common/dnd-context/index.tsx
@@ -2,12 +2,14 @@ import { DndContext as DndKitContext, DragEndEvent, DragOverlay, rectIntersectio
import { Props } from '@dnd-kit/core/dist/components/DndContext/DndContext';
import { observer } from '@formily/react';
import React from 'react';
+import { useTranslation } from 'react-i18next';
import { useAPIClient } from '../../../';
import { createDesignable, useDesignable } from '../../hooks';
const useDragEnd = (props?: any) => {
const { refresh } = useDesignable();
const api = useAPIClient();
+ const { t } = useTranslation();
return (event: DragEndEvent) => {
const { active, over } = event;
@@ -28,6 +30,7 @@ const useDragEnd = (props?: any) => {
}
const dn = createDesignable({
+ t,
api,
refresh,
current: overSchema,
diff --git a/packages/core/client/src/schema-component/core/DesignableSwitch.tsx b/packages/core/client/src/schema-component/core/DesignableSwitch.tsx
index 5eba50ddb..60f996f05 100644
--- a/packages/core/client/src/schema-component/core/DesignableSwitch.tsx
+++ b/packages/core/client/src/schema-component/core/DesignableSwitch.tsx
@@ -1,10 +1,12 @@
import { HighlightOutlined } from '@ant-design/icons';
import React from 'react';
+import { useTranslation } from 'react-i18next';
import { useDesignable } from '..';
import { PluginManager } from '../../plugin-manager';
export const DesignableSwitch = () => {
const { designable, setDesignable } = useDesignable();
+ const { t } = useTranslation();
const style = {};
if (designable) {
style['backgroundColor'] = '#f18b62';
@@ -13,7 +15,7 @@ export const DesignableSwitch = () => {
}
- title={'界面配置'}
+ title={t('UI Editor')}
style={style}
onClick={() => {
setDesignable(!designable);
diff --git a/packages/core/client/src/schema-component/hooks/useDesignable.tsx b/packages/core/client/src/schema-component/hooks/useDesignable.tsx
index 2ee78ee90..c6058f721 100644
--- a/packages/core/client/src/schema-component/hooks/useDesignable.tsx
+++ b/packages/core/client/src/schema-component/hooks/useDesignable.tsx
@@ -4,6 +4,7 @@ import { message } from 'antd';
import get from 'lodash/get';
import set from 'lodash/set';
import React, { useContext } from 'react';
+import { useTranslation } from 'react-i18next';
import { APIClient, useAPIClient } from '../../api-client';
import { SchemaComponentContext } from '../context';
@@ -12,6 +13,8 @@ interface CreateDesignableProps {
api?: APIClient;
refresh?: () => void;
onSuccess?: any;
+ i18n?: any;
+ t?: any;
}
export function createDesignable(options: CreateDesignableProps) {
@@ -90,6 +93,8 @@ export const splitWrapSchema = (wrapped: Schema, schema: ISchema) => {
return [schema1, schema2];
};
+const translate = (v?: any) => v;
+
export class Designable {
current: Schema;
options: CreateDesignableProps;
@@ -101,7 +106,7 @@ export class Designable {
}
loadAPIClientEvents() {
- const { refresh, api } = this.options;
+ const { refresh, api, t = translate } = this.options;
if (!api) {
return;
}
@@ -125,7 +130,7 @@ export class Designable {
});
}
onSuccess?.();
- message.success('配置保存成功!', 0.2);
+ message.success(t('Saved successfully'), 0.2);
});
this.on('patch', async ({ schema }) => {
refresh();
@@ -139,7 +144,7 @@ export class Designable {
...schema,
},
});
- message.success('配置保存成功!', 0.2);
+ message.success(t('Saved successfully'), 0.2);
});
this.on('remove', async ({ removed }) => {
refresh();
@@ -150,7 +155,7 @@ export class Designable {
url: `/uiSchemas:remove/${removed['x-uid']}`,
method: 'post',
});
- message.success('配置保存成功!', 0.2);
+ message.success(t('Saved successfully'), 0.2);
});
}
@@ -508,7 +513,8 @@ export function useDesignable() {
const field = useField();
const fieldSchema = useFieldSchema();
const api = useAPIClient();
- const dn = createDesignable({ api, refresh, current: fieldSchema });
+ const { t } = useTranslation();
+ const dn = createDesignable({ t, api, refresh, current: fieldSchema });
dn.loadAPIClientEvents();
return {
dn,
diff --git a/packages/core/client/src/schema-initializer/buttons/BlockInitializers.tsx b/packages/core/client/src/schema-initializer/buttons/BlockInitializers.tsx
index 095132f0d..ec3446eba 100644
--- a/packages/core/client/src/schema-initializer/buttons/BlockInitializers.tsx
+++ b/packages/core/client/src/schema-initializer/buttons/BlockInitializers.tsx
@@ -14,42 +14,42 @@ export const BlockInitializers = {
{
key: 'table',
type: 'item',
- title: 'Table',
+ title: '{{t("Table")}}',
component: 'TableBlockInitializer',
},
{
key: 'form',
type: 'item',
- title: 'Form',
+ title: '{{t("Form")}}',
component: 'FormBlockInitializer',
},
{
key: 'details',
type: 'item',
- title: 'Details',
+ title: '{{t("Details")}}',
component: 'DetailsBlockInitializer',
},
{
key: 'calendar',
type: 'item',
- title: 'Calendar',
+ title: '{{t("Calendar")}}',
component: 'CalendarBlockInitializer',
},
{
key: 'kanban',
type: 'item',
- title: 'Kanban',
+ title: '{{t("Kanban")}}',
component: 'KanbanBlockInitializer',
},
],
},
{
type: 'itemGroup',
- title: 'Media',
+ title: '{{t("Media")}}',
children: [
{
type: 'item',
- title: 'Markdown',
+ title: '{{t("Markdown")}}',
component: 'MarkdownBlockInitializer',
},
],
diff --git a/packages/core/client/src/schema-initializer/buttons/CalendarActionInitializers.tsx b/packages/core/client/src/schema-initializer/buttons/CalendarActionInitializers.tsx
index d7515b059..73f2cc587 100644
--- a/packages/core/client/src/schema-initializer/buttons/CalendarActionInitializers.tsx
+++ b/packages/core/client/src/schema-initializer/buttons/CalendarActionInitializers.tsx
@@ -1,19 +1,19 @@
// 日历的操作配置
export const CalendarActionInitializers = {
- title: 'Configure actions',
+ title: '{{t("Configure actions")}}',
icon: 'SettingOutlined',
style: { marginLeft: 8 },
items: [
{
type: 'itemGroup',
- title: 'Enable actions',
+ title: '{{t("Enable actions")}}',
children: [
{
type: 'item',
- title: 'Today',
+ title: '{{t("Today")}}',
component: 'ActionInitializer',
schema: {
- title: 'Today',
+ title: '{{t("Today")}}',
'x-component': 'CalendarV2.Today',
'x-action': `calendar:today`,
'x-align': 'left',
@@ -21,10 +21,10 @@ export const CalendarActionInitializers = {
},
{
type: 'item',
- title: 'Turn pages',
+ title: '{{t("Turn pages")}}',
component: 'ActionInitializer',
schema: {
- title: 'Turn pages',
+ title: '{{t("Turn pages")}}',
'x-component': 'CalendarV2.Nav',
'x-action': `calendar:nav`,
'x-align': 'left',
@@ -32,10 +32,10 @@ export const CalendarActionInitializers = {
},
{
type: 'item',
- title: 'Title',
+ title: '{{t("Title")}}',
component: 'ActionInitializer',
schema: {
- title: 'Title',
+ title: '{{t("Title")}}',
'x-component': 'CalendarV2.Title',
'x-action': `calendar:title`,
'x-align': 'left',
@@ -43,10 +43,10 @@ export const CalendarActionInitializers = {
},
{
type: 'item',
- title: 'Select view',
+ title: '{{t("Select view")}}',
component: 'ActionInitializer',
schema: {
- title: 'Select view',
+ title: '{{t("Select view")}}',
'x-component': 'CalendarV2.ViewSelect',
'x-action': `calendar:viewSelect`,
'x-align': 'right',
diff --git a/packages/core/client/src/schema-initializer/buttons/CreateFormBlockInitializers.tsx b/packages/core/client/src/schema-initializer/buttons/CreateFormBlockInitializers.tsx
index dc3f1f98e..96264da06 100644
--- a/packages/core/client/src/schema-initializer/buttons/CreateFormBlockInitializers.tsx
+++ b/packages/core/client/src/schema-initializer/buttons/CreateFormBlockInitializers.tsx
@@ -13,22 +13,22 @@ export const CreateFormBlockInitializers = (props: any) => {
items={[
{
type: 'itemGroup',
- title: '{{ t("Data blocks") }}',
+ title: '{{t("Data blocks")}}',
children: [
{
type: 'item',
- title: '{{ t("Form") }}',
+ title: '{{t("Form")}}',
component: 'CreateFormBlockInitializer',
},
],
},
{
type: 'itemGroup',
- title: 'Media',
+ title: '{{t("Media")}}',
children: [
{
type: 'item',
- title: 'Markdown',
+ title: '{{t("Markdown")}}',
component: 'MarkdownBlockInitializer',
},
],
diff --git a/packages/core/client/src/schema-initializer/buttons/FormActionInitializers.tsx b/packages/core/client/src/schema-initializer/buttons/FormActionInitializers.tsx
index d9a9e4bc5..e646f4513 100644
--- a/packages/core/client/src/schema-initializer/buttons/FormActionInitializers.tsx
+++ b/packages/core/client/src/schema-initializer/buttons/FormActionInitializers.tsx
@@ -1,3 +1,4 @@
+
// 表单的操作配置
export const FormActionInitializers = {
title: '{{t("Configure actions")}}',
@@ -15,7 +16,7 @@ export const FormActionInitializers = {
'x-action-settings': {
initialValues: {},
onSuccess: {
- successMessage: 'Submitted successfully!',
+ successMessage: '{{t("Submitted successfully")}}',
},
},
},
@@ -40,7 +41,7 @@ export const FormActionInitializers = {
'x-action-settings': {
initialValues: {},
onSuccess: {
- successMessage: 'Submitted successfully!',
+ successMessage: '{{t("Submitted successfully")}}',
},
},
'x-component-props': {
diff --git a/packages/core/client/src/schema-initializer/buttons/RecordBlockInitializers.tsx b/packages/core/client/src/schema-initializer/buttons/RecordBlockInitializers.tsx
index 525571acb..fc92fb63b 100644
--- a/packages/core/client/src/schema-initializer/buttons/RecordBlockInitializers.tsx
+++ b/packages/core/client/src/schema-initializer/buttons/RecordBlockInitializers.tsx
@@ -28,35 +28,35 @@ export const RecordBlockInitializers = (props: any) => {
items={[
{
type: 'itemGroup',
- title: '当前数据区块',
+ title: '{{t("Current record blocks")}}',
children: [
{
key: 'details',
type: 'item',
- title: 'Details',
+ title: '{{t("Details")}}',
component: 'RecordReadPrettyFormBlockInitializer',
},
{
key: 'form',
type: 'item',
- title: 'Form',
+ title: '{{t("Form")}}',
component: 'RecordFormBlockInitializer',
},
],
},
{
type: 'itemGroup',
- title: '关系数据区块',
+ title: '{{t("Relationship blocks")}}',
children: useRelationFields(),
},
{
type: 'itemGroup',
- title: 'Media',
+ title: '{{t("Media")}}',
children: [
{
key: 'markdown',
type: 'item',
- title: 'Markdown',
+ title: '{{t("Markdown")}}',
component: 'MarkdownBlockInitializer',
},
],
diff --git a/packages/core/client/src/schema-initializer/buttons/RecordFormBlockInitializers.tsx b/packages/core/client/src/schema-initializer/buttons/RecordFormBlockInitializers.tsx
index 6a3362d1e..81486a080 100644
--- a/packages/core/client/src/schema-initializer/buttons/RecordFormBlockInitializers.tsx
+++ b/packages/core/client/src/schema-initializer/buttons/RecordFormBlockInitializers.tsx
@@ -24,11 +24,11 @@ export const RecordFormBlockInitializers = (props: any) => {
},
{
type: 'itemGroup',
- title: 'Media',
+ title: '{{t("Media")}}',
children: [
{
type: 'item',
- title: 'Markdown',
+ title: '{{t("Markdown")}}',
component: 'MarkdownBlockInitializer',
},
],
diff --git a/packages/core/client/src/schema-initializer/buttons/TableActionColumnInitializers.tsx b/packages/core/client/src/schema-initializer/buttons/TableActionColumnInitializers.tsx
index 340730733..90d8d88c8 100644
--- a/packages/core/client/src/schema-initializer/buttons/TableActionColumnInitializers.tsx
+++ b/packages/core/client/src/schema-initializer/buttons/TableActionColumnInitializers.tsx
@@ -25,6 +25,7 @@ export const TableActionColumnInitializers = (props: any) => {
return;
}
const dn = createDesignable({
+ t,
api,
refresh,
current: spaceSchema,
diff --git a/packages/core/client/src/schema-initializer/buttons/TableSelectorInitializers.tsx b/packages/core/client/src/schema-initializer/buttons/TableSelectorInitializers.tsx
index 8b03306c2..87078630f 100644
--- a/packages/core/client/src/schema-initializer/buttons/TableSelectorInitializers.tsx
+++ b/packages/core/client/src/schema-initializer/buttons/TableSelectorInitializers.tsx
@@ -25,7 +25,7 @@ export const TableSelectorInitializers = (props: any) => {
},
{
type: 'itemGroup',
- title: 'Media',
+ title: t('Media'),
children: [
{
type: 'item',
diff --git a/packages/core/client/src/schema-initializer/items/index.tsx b/packages/core/client/src/schema-initializer/items/index.tsx
index 3dfaf6d5d..442c69bed 100644
--- a/packages/core/client/src/schema-initializer/items/index.tsx
+++ b/packages/core/client/src/schema-initializer/items/index.tsx
@@ -145,6 +145,7 @@ export const DetailsBlockInitializer = (props) => {
export const CalendarBlockInitializer = (props) => {
const { insert } = props;
+ const { t } = useTranslation();
const { getCollection } = useCollectionManager();
const options = useContext(SchemaOptionsContext);
return (
@@ -170,7 +171,7 @@ export const CalendarBlockInitializer = (props) => {
value: field.name,
};
});
- const values = await FormDialog('创建日历区块', () => {
+ const values = await FormDialog(t('Create calendar block'), () => {
return (
@@ -178,14 +179,14 @@ export const CalendarBlockInitializer = (props) => {
schema={{
properties: {
title: {
- title: '标题字段',
+ title: t('Title field'),
enum: stringFields,
required: true,
'x-component': 'Select',
'x-decorator': 'FormItem',
},
start: {
- title: '开始日期字段',
+ title: t('Start date field'),
enum: dateFields,
required: true,
default: 'createdAt',
@@ -193,7 +194,7 @@ export const CalendarBlockInitializer = (props) => {
'x-decorator': 'FormItem',
},
end: {
- title: '结束日期字段',
+ title: t('End date field'),
enum: dateFields,
'x-component': 'Select',
'x-decorator': 'FormItem',
@@ -222,6 +223,7 @@ export const CalendarBlockInitializer = (props) => {
export const KanbanBlockInitializer = (props) => {
const { insert } = props;
+ const { t } = useTranslation();
const { getCollection } = useCollectionManager();
const options = useContext(SchemaOptionsContext);
const api = useAPIClient();
@@ -244,7 +246,7 @@ export const KanbanBlockInitializer = (props) => {
},
};
});
- const values = await FormDialog('创建看板区块', () => {
+ const values = await FormDialog(t('Create kanban block'), () => {
return (
@@ -252,7 +254,7 @@ export const KanbanBlockInitializer = (props) => {
schema={{
properties: {
groupField: {
- title: '分组字段',
+ title: t('Group field'),
enum: fields,
required: true,
'x-component': 'Select',
diff --git a/packages/core/client/src/schema-initializer/utils.ts b/packages/core/client/src/schema-initializer/utils.ts
index 2717acb94..bcbcae1b0 100644
--- a/packages/core/client/src/schema-initializer/utils.ts
+++ b/packages/core/client/src/schema-initializer/utils.ts
@@ -164,7 +164,7 @@ export const useRecordCollectionDataSourceItems = (componentName) => {
{
type: 'item',
name: collection.name,
- title: '空白区块',
+ title: t('Blank block'),
},
{
type: 'divider',
@@ -173,7 +173,7 @@ export const useRecordCollectionDataSourceItems = (componentName) => {
key: `${componentName}_table_subMenu_${index}_copy`,
type: 'subMenu',
name: 'copy',
- title: '复制模板',
+ title: t('Duplicate template'),
children: templates.map((template) => {
const templateName =
template?.componentName === 'ReadPrettyFormItem' ? `${template?.name} ${t('(Fields only)')}` : template?.name;
@@ -182,7 +182,7 @@ export const useRecordCollectionDataSourceItems = (componentName) => {
mode: 'copy',
name: collection.name,
template,
- title: templateName || '未命名',
+ title: templateName || t('Untitled'),
};
}),
},
@@ -190,7 +190,7 @@ export const useRecordCollectionDataSourceItems = (componentName) => {
key: `${componentName}_table_subMenu_${index}_ref`,
type: 'subMenu',
name: 'ref',
- title: '引用模板',
+ title: t('Reference template'),
children: templates.map((template) => {
const templateName =
template?.componentName === 'ReadPrettyFormItem' ? `${template?.name} ${t('(Fields only)')}` : template?.name;
@@ -199,7 +199,7 @@ export const useRecordCollectionDataSourceItems = (componentName) => {
mode: 'reference',
name: collection.name,
template,
- title: templateName || '未命名',
+ title: templateName || t('Untitled'),
};
}),
},
@@ -214,7 +214,7 @@ export const useCollectionDataSourceItems = (componentName) => {
{
key: 'tableBlock',
type: 'itemGroup',
- title: t('Select data source'),
+ title: t('Select collection'),
children: collections
?.filter((item) => !item.inherit)
?.map((item, index) => {
@@ -237,7 +237,7 @@ export const useCollectionDataSourceItems = (componentName) => {
{
type: 'item',
name: item.name,
- title: '空白区块',
+ title: t('Blank block'),
},
{
type: 'divider',
@@ -246,7 +246,7 @@ export const useCollectionDataSourceItems = (componentName) => {
key: `${componentName}_table_subMenu_${index}_copy`,
type: 'subMenu',
name: 'copy',
- title: '复制模板',
+ title: t('Duplicate template'),
children: templates.map((template) => {
const templateName =
template?.componentName === 'FormItem' ? `${template?.name} ${t('(Fields only)')}` : template?.name;
@@ -255,7 +255,7 @@ export const useCollectionDataSourceItems = (componentName) => {
mode: 'copy',
name: item.name,
template,
- title: templateName || '未命名',
+ title: templateName || t('Untitled'),
};
}),
},
@@ -263,7 +263,7 @@ export const useCollectionDataSourceItems = (componentName) => {
key: `${componentName}_table_subMenu_${index}_ref`,
type: 'subMenu',
name: 'ref',
- title: '引用模板',
+ title: t('Reference template'),
children: templates.map((template) => {
const templateName =
template?.componentName === 'FormItem' ? `${template?.name} ${t('(Fields only)')}` : template?.name;
@@ -272,7 +272,7 @@ export const useCollectionDataSourceItems = (componentName) => {
mode: 'reference',
name: item.name,
template,
- title: templateName || '未命名',
+ title: templateName || t('Untitled'),
};
}),
},
@@ -657,7 +657,7 @@ export const createCalendarBlockSchema = (options) => {
properties: {
tab1: {
type: 'void',
- title: '详情',
+ title: '{{t("Details")}}',
'x-component': 'Tabs.TabPane',
'x-designer': 'Tabs.Designer',
'x-component-props': {},
@@ -725,7 +725,7 @@ export const createKanbanBlockSchema = (options) => {
},
},
cardAdder: {
- title: '添加卡片',
+ title: '{{t("Add new")}}',
type: 'void',
'x-designer': 'Action.Designer',
'x-designer-props': {
@@ -780,7 +780,7 @@ export const createKanbanBlockSchema = (options) => {
properties: {
tab1: {
type: 'void',
- title: '详情',
+ title: '{{t("Details")}}',
'x-component': 'Tabs.TabPane',
'x-designer': 'Tabs.Designer',
'x-component-props': {},
diff --git a/packages/core/client/src/schema-settings/GeneralSchemaDesigner.tsx b/packages/core/client/src/schema-settings/GeneralSchemaDesigner.tsx
index 5855dc9fb..63fc499b3 100644
--- a/packages/core/client/src/schema-settings/GeneralSchemaDesigner.tsx
+++ b/packages/core/client/src/schema-settings/GeneralSchemaDesigner.tsx
@@ -52,7 +52,7 @@ export const GeneralSchemaDesigner = (props: any) => {
{compile(title)}
- {template && 引用模板: {templateName || '未命名'}}
+ {template && {t('Reference template')}: {templateName || t('Untitled')}}
)}
diff --git a/packages/core/client/src/schema-settings/SchemaSettings.tsx b/packages/core/client/src/schema-settings/SchemaSettings.tsx
index bdb5a5196..ea9dda3b3 100644
--- a/packages/core/client/src/schema-settings/SchemaSettings.tsx
+++ b/packages/core/client/src/schema-settings/SchemaSettings.tsx
@@ -1,8 +1,10 @@
+import { css } from '@emotion/css';
import { FormDialog, FormItem, FormLayout, Input } from '@formily/antd';
import { GeneralField } from '@formily/core';
import { ISchema, Schema, SchemaOptionsContext } from '@formily/react';
import { uid } from '@formily/shared';
import { Dropdown, Menu, MenuItemProps, Modal, Select, Switch } from 'antd';
+import classNames from 'classnames';
import React, { createContext, useContext, useState } from 'react';
import { useTranslation } from 'react-i18next';
import {
@@ -87,6 +89,15 @@ export const SchemaSettings: React.FC & SchemaSettingsNeste
setVisible(visible);
}}
overlay={}
+ overlayClassName={classNames(
+ 'nb-schema-initializer-button-overlay',
+ css`
+ .ant-dropdown-menu-item-group-list {
+ max-height: 40vh;
+ overflow: auto;
+ }
+ `,
+ )}
>
{typeof title === 'string' ? {title} : title}
@@ -134,7 +145,7 @@ SchemaSettings.Template = (props) => {
{
setVisible(false);
- const values = await FormDialog('Save as template', () => {
+ const values = await FormDialog(t('Save as template'), () => {
return (
{
type: 'object',
properties: {
name: {
- title: '模板名称',
+ title: t('Template name'),
required: true,
'x-decorator': 'FormItem',
'x-component': 'Input',
@@ -155,6 +166,7 @@ SchemaSettings.Template = (props) => {
);
}).open({});
const sdn = createDesignable({
+ t,
api,
refresh: dn.refresh.bind(dn),
current: fieldSchema.parent,
@@ -231,6 +243,7 @@ SchemaSettings.FormItemTemplate = (props) => {
const schema = await copyTemplateSchema(template);
const templateSchema = findBlockTemplateSchema(fieldSchema);
const sdn = createDesignable({
+ t,
api,
refresh: dn.refresh.bind(dn),
current: templateSchema.parent,
@@ -275,7 +288,7 @@ SchemaSettings.FormItemTemplate = (props) => {
type: 'object',
properties: {
name: {
- title: '模板名称',
+ title: t('Template name'),
required: true,
'x-decorator': 'FormItem',
'x-component': 'Input',
@@ -287,6 +300,7 @@ SchemaSettings.FormItemTemplate = (props) => {
);
}).open({});
const sdn = createDesignable({
+ t,
api,
refresh: dn.refresh.bind(dn),
current: gridSchema.parent,
diff --git a/packages/plugins/acl/src/server.ts b/packages/plugins/acl/src/server.ts
index b5d744313..b9dfa80d1 100644
--- a/packages/plugins/acl/src/server.ts
+++ b/packages/plugins/acl/src/server.ts
@@ -256,27 +256,23 @@ export class PluginACL extends Plugin {
records: [
{
name: 'root',
- title: 'Root',
+ title: '{{t("Root")}}',
hidden: true,
},
{
name: 'admin',
- title: 'Admin',
+ title: '{{t("Admin")}}',
allowConfigure: true,
allowNewMenu: true,
strategy: { actions: ['create', 'export', 'view', 'update', 'destroy'] },
},
{
name: 'member',
- title: 'Member',
+ title: '{{t("Member")}}',
allowNewMenu: true,
strategy: { actions: ['view', 'update:own', 'destroy:own', 'create'] },
default: true,
},
- {
- name: 'anonymous',
- title: 'Anonymous',
- },
],
});
const rolesResourcesScopes = this.app.db.getRepository('rolesResourcesScopes');