From 1f04f90a00e071aa9ab294f21e8d02373191eecc Mon Sep 17 00:00:00 2001 From: chenos Date: Sat, 23 Apr 2022 11:55:33 +0800 Subject: [PATCH] feat: translations --- .../src/acl/Configuration/RoleConfigure.tsx | 10 ++- .../Configuration/RolesResourcesActions.tsx | 10 +-- .../src/acl/Configuration/StrategyActions.tsx | 16 ++-- .../src/acl/Configuration/schemas/roles.ts | 6 +- .../src/acl/Configuration/schemas/scopes.ts | 4 +- .../client/src/antd-config-provider/index.tsx | 4 +- .../core/client/src/api-client/APIClient.ts | 2 +- .../Configuration/AddFieldAction.tsx | 2 +- .../Configuration/AddSubFieldAction.tsx | 3 +- packages/core/client/src/i18n/i18n.ts | 6 +- packages/core/client/src/locale/zh_CN.ts | 90 +++++++++++++++++++ .../route-switch/antd/auth-layout/index.tsx | 4 +- .../antd/action/Action.Designer.tsx | 2 +- .../src/schema-settings/SchemaSettings.tsx | 2 +- packages/core/client/src/user/SigninPage.tsx | 1 - 15 files changed, 127 insertions(+), 35 deletions(-) diff --git a/packages/core/client/src/acl/Configuration/RoleConfigure.tsx b/packages/core/client/src/acl/Configuration/RoleConfigure.tsx index 4485c35bd..64fb8b985 100644 --- a/packages/core/client/src/acl/Configuration/RoleConfigure.tsx +++ b/packages/core/client/src/acl/Configuration/RoleConfigure.tsx @@ -1,6 +1,7 @@ import { onFieldChange } from '@formily/core'; import { message } from 'antd'; import React from 'react'; +import { useTranslation } from 'react-i18next'; import { useAPIClient, useRequest } from '../../api-client'; import { useRecord } from '../../record-provider'; import { SchemaComponent } from '../../schema-component'; @@ -8,6 +9,7 @@ import { SchemaComponent } from '../../schema-component'; export const RoleConfigure = () => { const api = useAPIClient(); const record = useRecord(); + const { t } = useTranslation(); return ( { filterByTk: record.name, values: form.values, }); - message.success('保存成功!'); + message.success(t('Saved successfully')); }); }, }, properties: { allowConfigure: { - title: '配置权限', + title: t('Configure permissions'), 'x-decorator': 'FormItem', 'x-component': 'Checkbox', 'x-content': '允许配置系统,包括界面配置、数据表配置、权限配置、系统配置等全部配置项', }, 'strategy.actions': { - title: '通用数据操作权限', + title: t('General action permissions'), description: '所有数据表都默认使用通用数据操作权限;同时,可以针对每个数据表单独配置权限。', 'x-component': 'StrategyActions', 'x-decorator': 'FormItem', }, allowNewMenu: { - title: '新增菜单项默认访问权限', + title: t('Menu permissions'), 'x-decorator': 'FormItem', 'x-component': 'Checkbox', 'x-content': '新增菜单项默认允许访问', diff --git a/packages/core/client/src/acl/Configuration/RolesResourcesActions.tsx b/packages/core/client/src/acl/Configuration/RolesResourcesActions.tsx index 5c42a93f5..12fe00566 100644 --- a/packages/core/client/src/acl/Configuration/RolesResourcesActions.tsx +++ b/packages/core/client/src/acl/Configuration/RolesResourcesActions.tsx @@ -97,17 +97,17 @@ export const RolesResourcesActions = connect((props) => { }, { dataIndex: 'onNewRecord', - title: '类型', + title: t('Action type'), render: (onNewRecord) => onNewRecord ? ( - {t('Operate on new record')} + {t('Action on new records')} ) : ( - {t('Operate on existing record')} + {t('Action on existing records')} ), }, { dataIndex: 'enabled', - title: '允许操作', + title: t("Allow"), render: (enabled, action) => ( { }, { dataIndex: 'scope', - title: '可操作的数据范围', + title: t("Data scope"), render: (value, action) => !action.onNewRecord && ( { columns={[ { dataIndex: 'displayName', - title: '操作', + title: t('Action display name'), render: (value) => compile(value), }, { dataIndex: 'onNewRecord', - title: '类型', + title: t('Action type'), render: (onNewRecord) => onNewRecord ? ( - {t('Operate on new record')} + {t('Action on new records')} ) : ( - {t('Operate on existing record')} + {t('Action on existing records')} ), }, { dataIndex: 'enabled', - title: '允许操作', + title: t('Allow'), render: (enabled, action) => ( { }, { dataIndex: 'scope', - title: '可操作的数据范围', + title: t('Data scope'), render: (scope, action) => !action.onNewRecord && (