feat: translation

This commit is contained in:
chenos 2022-05-01 11:09:22 +08:00
parent ebfe11ff09
commit 5a023f5eec
4 changed files with 9 additions and 5 deletions

View File

@ -9,3 +9,4 @@ package.json
packages/**/lib/**
packages/**/esm/**
packages/**/node_modules/**
packages/core/client/src/locale/*

View File

@ -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': '拖拽中',
}

View File

@ -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<any>();
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)}
<Designer {...designerProps} />
</SortableItem>
);

View File

@ -57,6 +57,7 @@ const useDragEnd = (props?: any) => {
};
export const DndContext = observer((props: Props) => {
const { t } = useTranslation();
return (
<DndKitContext collisionDetection={rectIntersection} {...props} onDragEnd={useDragEnd(props)}>
<DragOverlay
@ -65,7 +66,7 @@ export const DndContext = observer((props: Props) => {
easing: 'cubic-bezier(0.18, 0.67, 0.6, 1.22)',
}}
>
<span style={{ whiteSpace: 'nowrap' }}></span>
<span style={{ whiteSpace: 'nowrap' }}>{t('Dragging')}</span>
</DragOverlay>
{props.children}
</DndKitContext>