From 870fc9144ac46560107960d55723afa2586ff9ae Mon Sep 17 00:00:00 2001 From: Bowen Tan Date: Thu, 9 Jun 2022 18:24:08 +0800 Subject: [PATCH] chore(examples): translate and change text in examples - @sunmao-ui/arco-lib@0.3.0-alpha.1 - @sunmao-ui/chakra-ui-lib@0.5.0-alpha.1 - @sunmao-ui/editor-sdk@0.3.0-alpha.1 - @sunmao-ui/editor@0.7.0-alpha.1 - @sunmao-ui/runtime@0.7.0-alpha.1 - @sunmao-ui/shared@0.2.0-alpha.1 --- examples/dialog/dialogInList.json | 50 ++++++++-------- examples/form/basic.json | 6 +- examples/form/formInDialog.json | 57 +++++++++---------- examples/grid-layout/basic.json | 2 +- .../input-components/inputValidation.json | 8 +-- examples/table/tableWithForm.json | 49 ++++++++-------- .../src/examples/pages/table/attributes.ts | 14 ++--- .../src/examples/pages/table/selection.ts | 14 ++--- .../src/examples/pages/table/sortAndFilter.ts | 10 ++-- .../src/components/Form/Form.tsx | 2 +- packages/runtime/index.html | 2 - .../runtime/src/traits/core/Validation.tsx | 8 +-- 12 files changed, 109 insertions(+), 113 deletions(-) diff --git a/examples/dialog/dialogInList.json b/examples/dialog/dialogInList.json index 964f0e82..4639865f 100644 --- a/examples/dialog/dialogInList.json +++ b/examples/dialog/dialogInList.json @@ -32,7 +32,7 @@ "type": "core/v1/text", "properties": { "value": { - "raw": "姓名:{{name}}", + "raw": "name:{{name}}", "format": "plain" } }, @@ -74,7 +74,7 @@ "type": "chakra_ui/v1/button", "properties": { "text": { - "raw": "删除", + "raw": "Delete", "format": "plain" } }, @@ -118,7 +118,7 @@ "type": "chakra_ui/v1/button", "properties": { "text": { - "raw": "编辑", + "raw": "Edit", "format": "plain" } }, @@ -205,7 +205,7 @@ "type": "core/v1/state", "properties": { "key": "listTitle", - "initialValue": "客户列表" + "initialValue": "Customers List" } }, { @@ -215,28 +215,28 @@ "initialValue": [ { "id": 1, - "name": "马云", - "email": "jack.ma@deck.com" + "name": "Tom", + "email": "tom@deck.com" }, { "id": 2, - "name": "马化腾", - "email": "pony.ma@conversation.com" + "name": "Jack", + "email": "jack@conversation.com" }, { "id": 3, - "name": "李彦宏", - "email": "robin.li@response.com" + "name": "Pony", + "email": "pony@response.com" }, { "id": 4, - "name": "张一鸣", - "email": "yiming.zhang@example.com" + "name": "Peter", + "email": "peter@example.com" }, { "id": 5, - "name": "王兴", - "email": "xing.wang@widget.org" + "name": "John", + "email": "john@widget.org" } ] } @@ -297,7 +297,7 @@ "name": "setValue", "parameters": { "key": "deleteContent", - "value": "是否确认删除『{{ $listItem.name }}: {{ $listItem.email }}』" + "value": "Confirm to delete {{ $listItem.name }}: {{ $listItem.email }}』" } }, "wait": { @@ -312,7 +312,7 @@ "method": { "name": "openDialog", "parameters": { - "title": "删除信息" + "title": "Delete Info" } }, "wait": {}, @@ -363,7 +363,7 @@ "method": { "name": "openDialog", "parameters": { - "title": "编辑信息" + "title": "Edit Info" } }, "wait": {}, @@ -485,7 +485,7 @@ "properties": { "left": { "type": "addon", - "children": "姓名" + "children": "name" }, "defaultValue": "{{ root.nameInputInitialValue }}" }, @@ -507,7 +507,7 @@ "properties": { "left": { "type": "addon", - "children": "邮箱" + "children": "email" }, "defaultValue": "{{ root.emailInputInitialValue }}" }, @@ -529,10 +529,10 @@ "properties": { "title": "This is a dialog", "confirmButton": { - "text": "确定" + "text": "Delete" }, "cancelButton": { - "text": "取消" + "text": "Cancel" } }, "traits": [ @@ -623,7 +623,7 @@ "type": "chakra_ui/v1/button", "properties": { "text": { - "raw": "添加客户", + "raw": "Add Customer", "format": "plain" } }, @@ -642,7 +642,7 @@ "method": { "name": "openDialog", "parameters": { - "title": "编辑信息" + "title": "Edit Info" } }, "wait": {}, @@ -735,7 +735,7 @@ "properties": { "left": { "type": "addon", - "children": "姓名" + "children": "name" }, "defaultValue": "" }, @@ -757,7 +757,7 @@ "properties": { "left": { "type": "addon", - "children": "邮箱" + "children": "email" }, "initialValue": "" }, diff --git a/examples/form/basic.json b/examples/form/basic.json index f555690e..cbdf3a2a 100644 --- a/examples/form/basic.json +++ b/examples/form/basic.json @@ -44,7 +44,7 @@ "componentId": "$utils", "method": { "name": "alert", - "parameters": "邮箱:{{ form.data ? form.data.email : \"\" }} 手机:{{ form.data ? form.data.phone : \"\" }}" + "parameters": "email:{{ form.data ? form.data.email : \"\" }} phone:{{ form.data ? form.data.phone : \"\" }}" }, "wait": {}, "disabled": false @@ -70,7 +70,7 @@ "id": "emailFormControl", "type": "chakra_ui/v1/formControl", "properties": { - "label": "邮箱", + "label": "email", "fieldName": "email", "isRequired": true }, @@ -106,7 +106,7 @@ "id": "phoneFormControl", "type": "chakra_ui/v1/formControl", "properties": { - "label": "手机", + "label": "phone", "fieldName": "phone", "isRequired": true }, diff --git a/examples/form/formInDialog.json b/examples/form/formInDialog.json index fbf73a22..ec686653 100644 --- a/examples/form/formInDialog.json +++ b/examples/form/formInDialog.json @@ -46,8 +46,8 @@ "name": "chakra_ui/v1/openToast", "parameters": { "id": "createSuccessToast", - "title": "恭喜", - "description": "创建虚拟卷成功", + "title": "Congratulations", + "description": "Create Success", "position": "bottom-right", "duration": null, "isClosable": true @@ -122,7 +122,7 @@ "colorScheme": "purple" }, "cancelButton": { - "text": "取消" + "text": "Cancel" }, "disableConfirm": "{{ form.isFormInvalid }}" }, @@ -182,38 +182,38 @@ }, { "key": "name", - "title": "名称", + "title": "Name", "type": "text" }, { "key": "type", - "title": "类别", + "title": "Type", "type": "text", - "displayValue": "{{$listItem.type === \"sharing\" ? \"共享虚拟卷\" : \"虚拟卷\"}}" + "displayValue": "{{$listItem.type === \"sharing\" ? \"Shared Volume\" : \"Volume\"}}" }, { "key": "size", - "title": "容量", + "title": "Capacity", "type": "text", "displayValue": "{{$listItem.size}} GiB" }, { "key": "policy", - "title": "存储策略", + "title": "Policy", "type": "text" }, { "key": "isActive", - "title": "是否激活", + "title": "Active", "type": "text", - "displayValue": "{{$listItem.isActive ? \"是\" : \"否\"}}" + "displayValue": "{{$listItem.isActive ? \"Yes\" : \"No\"}}" }, { "key": "operation", - "title": "操作", + "title": "Operation", "type": "button", "buttonConfig": { - "text": "删除", + "text": "Delete", "handlers": [ { "componentId": "deleteVolume", @@ -226,17 +226,17 @@ }, { "key": "edit", - "title": "创建", + "title": "Create", "type": "button", "buttonConfig": { - "text": "创建", + "text": "Create", "handlers": [ { "componentId": "editDialog", "method": { "name": "openDialog", "parameters": { - "title": "创建虚拟卷" + "title": "Create Volume" } } } @@ -279,7 +279,7 @@ "id": "nameFormControl", "type": "chakra_ui/v1/formControl", "properties": { - "label": "名称", + "label": "Name", "fieldName": "name", "isRequired": true }, @@ -325,9 +325,8 @@ "id": "typeFormControl", "type": "chakra_ui/v1/formControl", "properties": { - "label": "类型", - "fieldName": "type", - "helperText": "共享虚拟卷支持被多台虚拟机同时挂载。类型创建后不可修改。" + "label": "Type", + "fieldName": "type" }, "traits": [ { @@ -364,7 +363,7 @@ "type": "chakra_ui/v1/radio", "properties": { "text": { - "raw": "虚拟卷", + "raw": "Volume", "format": "plain" }, "value": "notSharing" @@ -386,7 +385,7 @@ "type": "chakra_ui/v1/radio", "properties": { "text": { - "raw": "共享虚拟卷", + "raw": "Shared Volume", "format": "plain" }, "value": "sharing", @@ -408,7 +407,7 @@ "id": "sizeFormControl", "type": "chakra_ui/v1/formControl", "properties": { - "label": "容量", + "label": "Capacity", "fieldName": "size", "isRequired": true }, @@ -452,7 +451,7 @@ "id": "policyFormControl", "type": "chakra_ui/v1/formControl", "properties": { - "label": "存储策略", + "label": "Policy", "fieldName": "policy" }, "traits": [ @@ -475,19 +474,19 @@ "options": [ { "value": "2thin", - "label": "2 副本,精简置备" + "label": "2 replicas,thin" }, { "value": "3thin", - "label": "3 副本,精简置备" + "label": "3 replicas,thin" }, { "value": "2thick", - "label": "2 副本,厚置备" + "label": "2 replicas,thick" }, { "value": "3thick", - "label": "3 副本,厚置备" + "label": "3 replicas,thick" } ] }, @@ -507,7 +506,7 @@ "id": "isActiveFormControl", "type": "chakra_ui/v1/formControl", "properties": { - "label": "激活", + "label": "Active", "fieldName": "isActive" }, "traits": [ @@ -529,7 +528,7 @@ "value": "isActive", "defaultIsChecked": "{{table.selectedItem ? !!table.selectedItem.isActive : false}}", "text": { - "raw": "激活", + "raw": "Active", "format": "plain" } }, diff --git a/examples/grid-layout/basic.json b/examples/grid-layout/basic.json index 102bf9de..6bd69895 100644 --- a/examples/grid-layout/basic.json +++ b/examples/grid-layout/basic.json @@ -110,7 +110,7 @@ { "id": "component0", "type": "chakra_ui/v1/button", - "properties": { "text": { "raw": "提交" } }, + "properties": { "text": { "raw": "Submit" } }, "traits": [ { "type": "core/v1/slot", diff --git a/examples/input-components/inputValidation.json b/examples/input-components/inputValidation.json index 5bfc5b58..21e72bc4 100644 --- a/examples/input-components/inputValidation.json +++ b/examples/input-components/inputValidation.json @@ -14,7 +14,7 @@ "size": "lg", "left": { "type": "addon", - "children": "邮箱" + "children": "email" } }, "traits": [ @@ -47,7 +47,7 @@ "size": "lg", "left": { "type": "addon", - "children": "手机" + "children": "phone" } }, "traits": [ @@ -78,7 +78,7 @@ "type": "chakra_ui/v1/button", "properties": { "text": { - "raw": "提交", + "raw": "Submit", "format": "plain" } }, @@ -92,7 +92,7 @@ "componentId": "$utils", "method": { "name": "alert", - "parameters": "{{ `邮箱:${ emailInput.value } 手机号:${ phoneInput.value }` }}" + "parameters": "{{ `email:${ emailInput.value } phone:${ phoneInput.value }` }}" }, "wait": {}, "disabled": "{{ emailInput.validResult.isInvalid || phoneInput.validResult.isInvalid }}" diff --git a/examples/table/tableWithForm.json b/examples/table/tableWithForm.json index 5888ba1b..c93cd7a0 100644 --- a/examples/table/tableWithForm.json +++ b/examples/table/tableWithForm.json @@ -46,8 +46,8 @@ "name": "chakra_ui/v1/openToast", "parameters": { "id": "createSuccessToast", - "title": "恭喜", - "description": "创建虚拟卷成功", + "title": "Congratulations", + "description": "Create Success", "position": "bottom-right", "duration": null, "isClosable": true @@ -137,38 +137,38 @@ }, { "key": "name", - "title": "名称", + "title": "Name", "type": "text" }, { "key": "type", - "title": "类别", + "title": "Type", "type": "text", - "displayValue": "{{$listItem.type === \"sharing\" ? \"共享虚拟卷\" : \"虚拟卷\"}}" + "displayValue": "{{$listItem.type === \"sharing\" ? \"Shared Volume\" : \"Volume\"}}" }, { "key": "size", - "title": "容量", + "title": "Capacity", "type": "text", "displayValue": "{{$listItem.size}} GiB" }, { "key": "policy", - "title": "存储策略", + "title": "Policy", "type": "text" }, { "key": "isActive", - "title": "是否激活", + "title": "Active", "type": "text", - "displayValue": "{{$listItem.isActive ? \"是\" : \"否\"}}" + "displayValue": "{{$listItem.isActive ? \"Yes\" : \"No\"}}" }, { "key": "operation", - "title": "操作", + "title": "Operation", "type": "button", "buttonConfig": { - "text": "删除", + "text": "Delete", "handlers": [ { "componentId": "deleteVolume", @@ -229,7 +229,7 @@ "id": "nameFormControl", "type": "chakra_ui/v1/formControl", "properties": { - "label": "名称", + "label": "Name", "fieldName": "name", "isRequired": true }, @@ -275,9 +275,8 @@ "id": "typeFormControl", "type": "chakra_ui/v1/formControl", "properties": { - "label": "类型", - "fieldName": "type", - "helperText": "共享虚拟卷支持被多台虚拟机同时挂载。类型创建后不可修改。" + "label": "Type", + "fieldName": "type" }, "traits": [ { @@ -314,7 +313,7 @@ "type": "chakra_ui/v1/radio", "properties": { "text": { - "raw": "虚拟卷", + "raw": "Volume", "format": "plain" }, "value": "notSharing" @@ -336,7 +335,7 @@ "type": "chakra_ui/v1/radio", "properties": { "text": { - "raw": "共享虚拟卷", + "raw": "Shared Volume", "format": "plain" }, "value": "sharing", @@ -358,7 +357,7 @@ "id": "sizeFormControl", "type": "chakra_ui/v1/formControl", "properties": { - "label": "容量", + "label": "Capacity", "fieldName": "size", "isRequired": true }, @@ -402,7 +401,7 @@ "id": "policyFormControl", "type": "chakra_ui/v1/formControl", "properties": { - "label": "存储策略", + "label": "Policy", "fieldName": "policy" }, "traits": [ @@ -425,19 +424,19 @@ "options": [ { "value": "2thin", - "label": "2 副本,精简置备" + "label": "2 replicas,thin" }, { "value": "3thin", - "label": "3 副本,精简置备" + "label": "3 replicas,thin" }, { "value": "2thick", - "label": "2 副本,厚置备" + "label": "2 replicas,thick" }, { "value": "3thick", - "label": "3 副本,厚置备" + "label": "3 replicas,thick" } ] }, @@ -457,7 +456,7 @@ "id": "isActiveFormControl", "type": "chakra_ui/v1/formControl", "properties": { - "label": "激活", + "label": "Active", "fieldName": "isActive" }, "traits": [ @@ -479,7 +478,7 @@ "value": "isActive", "defaultIsChecked": "{{table.selectedItem ? !!table.selectedItem.isActive : false}}", "text": { - "raw": "激活", + "raw": "Active", "format": "plain" } }, diff --git a/packages/arco-lib/src/examples/pages/table/attributes.ts b/packages/arco-lib/src/examples/pages/table/attributes.ts index 2b0a600d..03ed0acf 100644 --- a/packages/arco-lib/src/examples/pages/table/attributes.ts +++ b/packages/arco-lib/src/examples/pages/table/attributes.ts @@ -661,14 +661,14 @@ export const attributes: Application = { data: [ { key: 'key 0', - name: 'xzdry0', + name: 'Peter0', link: 'link-B', salary: 59, time: '2021-7-11T1:10:45.437Z', }, { key: 'key 1', - name: 'xzdry1', + name: 'Peter1', link: 'link-A', salary: 371, time: '2021-1-11T11:10:45.437Z', @@ -696,35 +696,35 @@ export const attributes: Application = { }, { key: 'key 5', - name: 'xzdry5', + name: 'Peter5', link: 'link-A', salary: 297, time: '2021-6-11T8:10:45.437Z', }, { key: 'key 6', - name: 'xzdry6', + name: 'Peter6', link: 'link-A', salary: 799, time: '2021-0-11T9:10:45.437Z', }, { key: 'key 7', - name: 'xzdry7', + name: 'Peter7', link: 'link-B', salary: 242, time: '2021-10-11T0:10:45.437Z', }, { key: 'key 8', - name: 'xzdry8', + name: 'Peter8', link: 'link-B', salary: 798, time: '2021-2-11T2:10:45.437Z', }, { key: 'key 9', - name: 'xzdry9', + name: 'Peter9', link: 'link-B', salary: 947, time: '2021-1-11T9:10:45.437Z', diff --git a/packages/arco-lib/src/examples/pages/table/selection.ts b/packages/arco-lib/src/examples/pages/table/selection.ts index 15af3225..dfd7c014 100644 --- a/packages/arco-lib/src/examples/pages/table/selection.ts +++ b/packages/arco-lib/src/examples/pages/table/selection.ts @@ -97,14 +97,14 @@ export const selection: Application = { data: [ { key: 'key 0', - name: 'xzdry0', + name: 'Peter0', link: 'link-B', salary: 59, time: '2021-7-11T1:10:45.437Z', }, { key: 'key 1', - name: 'xzdry1', + name: 'Peter1', link: 'link-A', salary: 371, time: '2021-1-11T11:10:45.437Z', @@ -132,35 +132,35 @@ export const selection: Application = { }, { key: 'key 5', - name: 'xzdry5', + name: 'Peter5', link: 'link-A', salary: 297, time: '2021-6-11T8:10:45.437Z', }, { key: 'key 6', - name: 'xzdry6', + name: 'Peter6', link: 'link-A', salary: 799, time: '2021-0-11T9:10:45.437Z', }, { key: 'key 7', - name: 'xzdry7', + name: 'Peter7', link: 'link-B', salary: 242, time: '2021-10-11T0:10:45.437Z', }, { key: 'key 8', - name: 'xzdry8', + name: 'Peter8', link: 'link-B', salary: 798, time: '2021-2-11T2:10:45.437Z', }, { key: 'key 9', - name: 'xzdry9', + name: 'Peter9', link: 'link-B', salary: 947, time: '2021-1-11T9:10:45.437Z', diff --git a/packages/arco-lib/src/examples/pages/table/sortAndFilter.ts b/packages/arco-lib/src/examples/pages/table/sortAndFilter.ts index e0998210..fd20f923 100644 --- a/packages/arco-lib/src/examples/pages/table/sortAndFilter.ts +++ b/packages/arco-lib/src/examples/pages/table/sortAndFilter.ts @@ -81,7 +81,7 @@ export const sortAndFilter: Application = { }, { key: 'key 3', - name: 'xzdry3', + name: 'Peter3', link: 'link-B', salary: 427, time: '2021-10-11T9:10:45.437Z', @@ -95,7 +95,7 @@ export const sortAndFilter: Application = { }, { key: 'key 5', - name: 'xzdry5', + name: 'Peter5', link: 'link-B', salary: 811, time: '2021-8-11T5:10:45.437Z', @@ -116,7 +116,7 @@ export const sortAndFilter: Application = { }, { key: 'key 8', - name: 'xzdry8', + name: 'Peter8', link: 'link-A', salary: 87, time: '2021-3-11T6:10:45.437Z', @@ -130,14 +130,14 @@ export const sortAndFilter: Application = { }, { key: 'key 10', - name: 'xzdry10', + name: 'Peter10', link: 'link-B', salary: 935, time: '2021-10-11T4:10:45.437Z', }, { key: 'key 11', - name: 'xzdry11', + name: 'Peter11', link: 'link-A', salary: 381, time: '2021-0-11T14:10:45.437Z', diff --git a/packages/chakra-ui-lib/src/components/Form/Form.tsx b/packages/chakra-ui-lib/src/components/Form/Form.tsx index de7f3940..3f5aa481 100644 --- a/packages/chakra-ui-lib/src/components/Form/Form.tsx +++ b/packages/chakra-ui-lib/src/components/Form/Form.tsx @@ -167,7 +167,7 @@ export default implementRuntimeComponent({ disabled={isFormInvalid} onClick={onSubmit} > - 提交 + Submit )} diff --git a/packages/runtime/index.html b/packages/runtime/index.html index ed968c33..731a90fb 100644 --- a/packages/runtime/index.html +++ b/packages/runtime/index.html @@ -31,8 +31,6 @@ ReactDOM.unmountComponentAtNode(rootEl); const { App, registry } = initSunmaoUI({ libs: [sunmaoChakraUILib] }); const { app, modules = [] } = example.value; - console.log('example', example); - console.log('modules', modules); window.registry = registry; modules.forEach(m => { registry.registerModule(m); diff --git a/packages/runtime/src/traits/core/Validation.tsx b/packages/runtime/src/traits/core/Validation.tsx index 8fb5e0f4..655f3e9f 100644 --- a/packages/runtime/src/traits/core/Validation.tsx +++ b/packages/runtime/src/traits/core/Validation.tsx @@ -49,7 +49,7 @@ export default implementRuntimeTrait({ } else { return { isInvalid: true, - errorMsg: '请输入正确的 email', + errorMsg: 'Please enter valid email.', }; } }); @@ -63,7 +63,7 @@ export default implementRuntimeTrait({ } else { return { isInvalid: true, - errorMsg: '请输入正确的手机号码', + errorMsg: 'Please enter valid phone number.', }; } }); @@ -79,10 +79,10 @@ export default implementRuntimeTrait({ if (maxLength !== undefined && value.length > maxLength) { result.isInvalid = true; - result.errorMsg = `最长不能超过${maxLength}个字符`; + result.errorMsg = `Can not be longer than ${maxLength}.`; } else if (minLength !== undefined && value.length < minLength) { result.isInvalid = true; - result.errorMsg = `不能少于${minLength}个字符`; + result.errorMsg = `Can not be shorter than ${minLength}.`; } else { const rulesArr = rule ? rule.split(',') : []; for (const ruleName of rulesArr) {