From 5a023f5eec8888dd414f426383d46341968dbc66 Mon Sep 17 00:00:00 2001 From: chenos Date: Sun, 1 May 2022 11:09:22 +0800 Subject: [PATCH] feat: translation --- .prettierignore | 3 ++- packages/core/client/src/locale/zh_CN.ts | 3 ++- .../core/client/src/schema-component/antd/action/Action.tsx | 5 +++-- .../client/src/schema-component/common/dnd-context/index.tsx | 3 ++- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.prettierignore b/.prettierignore index b60e8840b..5a7614395 100644 --- a/.prettierignore +++ b/.prettierignore @@ -8,4 +8,5 @@ package.json .umi-test packages/**/lib/** packages/**/esm/** -packages/**/node_modules/** \ No newline at end of file +packages/**/node_modules/** +packages/core/client/src/locale/* diff --git a/packages/core/client/src/locale/zh_CN.ts b/packages/core/client/src/locale/zh_CN.ts index 918cfa66b..e2d56da31 100644 --- a/packages/core/client/src/locale/zh_CN.ts +++ b/packages/core/client/src/locale/zh_CN.ts @@ -476,5 +476,6 @@ export default { 'Multiple records': '多条数据', 'Please select collection first': '请先选择数据表', 'Only update records matching conditions': '只更新满足条件的数据', - 'Fields that are not assigned a value will be set to the default value, and those that do not have a default value are set to null.': '未被赋值的字段将被设置为默认值,没有默认值的设置为空值。' + 'Fields that are not assigned a value will be set to the default value, and those that do not have a default value are set to null.': '未被赋值的字段将被设置为默认值,没有默认值的设置为空值。', + 'Dragging': '拖拽中', } diff --git a/packages/core/client/src/schema-component/antd/action/Action.tsx b/packages/core/client/src/schema-component/antd/action/Action.tsx index b0512128d..604fc6fe8 100644 --- a/packages/core/client/src/schema-component/antd/action/Action.tsx +++ b/packages/core/client/src/schema-component/antd/action/Action.tsx @@ -6,7 +6,7 @@ import React, { useState } from 'react'; import { useActionContext } from '../..'; import { Icon } from '../../../icon'; import { SortableItem } from '../../common'; -import { useDesigner } from '../../hooks'; +import { useCompile, useDesigner } from '../../hooks'; import { useProps } from '../../hooks/useProps'; import ActionContainer from './Action.Container'; import { ActionDesigner } from './Action.Designer'; @@ -84,6 +84,7 @@ export const Action: ComposedAction = observer((props: any) => { const field = useField(); const { run } = useAction(); const fieldSchema = useFieldSchema(); + const compile = useCompile(); const designerProps = fieldSchema['x-designer-props']; const openMode = fieldSchema?.['x-component-props']?.['openMode']; const renderButton = () => ( @@ -111,7 +112,7 @@ export const Action: ComposedAction = observer((props: any) => { component={component || Button} className={classnames(className, actionDesignerCss)} > - {field.title} + {compile(fieldSchema.title)} ); 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 9fe07dfc3..8f6013b9a 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 @@ -57,6 +57,7 @@ const useDragEnd = (props?: any) => { }; export const DndContext = observer((props: Props) => { + const { t } = useTranslation(); return ( { easing: 'cubic-bezier(0.18, 0.67, 0.6, 1.22)', }} > - 拖拽中 + {t('Dragging')} {props.children}