From 5eb5ca62d02d9369e00a8c74a8de8aff2505e2e6 Mon Sep 17 00:00:00 2001 From: Ilan Date: Mon, 1 Oct 2018 13:14:44 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=8C=90=20localization=20of=20basic=20form?= =?UTF-8?q?=20page=20(#2464)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/locales/en-US.js | 36 ++++++++++++ src/locales/zh-CN.js | 35 +++++++++++ src/pages/Forms/BasicForm.js | 111 ++++++++++++++++++++++++----------- 3 files changed, 148 insertions(+), 34 deletions(-) diff --git a/src/locales/en-US.js b/src/locales/en-US.js index 5526359a..cce61a51 100644 --- a/src/locales/en-US.js +++ b/src/locales/en-US.js @@ -16,11 +16,44 @@ export default { 'validation.phone-number.required': 'Please enter your phone number!', 'validation.phone-number.wrong-format': 'Malformed phone number!', 'validation.verification-code.required': 'Please enter the verification code!', + 'validation.title.required': 'Please enter a title', + 'validation.date.required': 'Please select the start and end date', + 'validation.goal.required': 'Please enter a description of the goal', + 'validation.standard.required': 'Please enter a metric', + 'form.optional': ' (optional) ', + 'form.submit': 'Submit', + 'form.save': 'Save', 'form.email.placeholder': 'Email', 'form.password.placeholder': 'Password', 'form.confirm-password.placeholder': 'Confirm password', 'form.phone-number.placeholder': 'Phone number', 'form.verification-code.placeholder': 'Verification code', + 'form.title.label': 'Title', + 'form.title.placeholder': 'Give the target a name', + 'form.date.label': 'Start and end date', + 'form.date.placeholder.start': 'Start date', + 'form.date.placeholder.end': 'End date', + 'form.goal.label': 'Goal description', + 'form.goal.placeholder': 'Please enter your work goals', + 'form.standard.label': 'Metrics', + 'form.standard.placeholder': 'Please enter a metric', + 'form.client.label': 'Client', + 'form.client.label.tooltip': 'Target service object', + 'form.client.placeholder': + 'Please describe your customer service, internal customers directly @ Name / job number', + 'form.invites.label': 'Inviting critics', + 'form.invites.placeholder': 'Please direct @ Name / job number, you can invite up to 5 people', + 'form.weight.label': 'Weight', + 'form.weight.placeholder': 'Please enter weight', + 'form.public.label': 'Target disclosure', + 'form.public.label.help': 'Customers and invitees are shared by default', + 'form.public.radio.public': 'Public', + 'form.public.radio.partially-public': 'Partially public', + 'form.public.radio.private': 'Private', + 'form.publicUsers.placeholder': 'Open to', + 'form.publicUsers.option.A': 'Colleague A', + 'form.publicUsers.option.B': 'Colleague B', + 'form.publicUsers.option.C': 'Colleague C', 'component.globalHeader.search': 'Search', 'component.globalHeader.search.example1': 'Search example 1', 'component.globalHeader.search.example2': 'Search example 2', @@ -119,6 +152,9 @@ export default { 'app.analysis.table.search-keyword': 'Keyword', 'app.analysis.table.users': 'Users', 'app.analysis.table.weekly-range': 'Weekly Range', + 'app.forms.basic.title': 'Basic form', + 'app.forms.basic.description': + 'Form pages are used to collect or verify information to users, and basic forms are common in scenarios where there are fewer data items.', 'app.settings.menuMap.basic': 'Basic Settings', 'app.settings.menuMap.security': 'Security Settings', 'app.settings.menuMap.binding': 'Account Binding', diff --git a/src/locales/zh-CN.js b/src/locales/zh-CN.js index b50ece0c..35219ba1 100644 --- a/src/locales/zh-CN.js +++ b/src/locales/zh-CN.js @@ -17,11 +17,43 @@ export default { 'validation.phone-number.required': '请输入手机号!', 'validation.phone-number.wrong-format': '手机号格式错误!', 'validation.verification-code.required': '请输入验证码!', + 'validation.title.required': '请输入标题', + 'validation.date.required': '请选择起止日期', + 'validation.goal.required': '请输入目标描述', + 'validation.standard.required': '请输入衡量标准', + 'form.optional': '(选填)', + 'form.submit': '提交', + 'form.save': '保存', 'form.email.placeholder': '邮箱', 'form.password.placeholder': '至少6位密码,区分大小写', 'form.confirm-password.placeholder': '确认密码', 'form.phone-number.placeholder': '位手机号', 'form.verification-code.placeholder': '验证码', + 'form.title.label': '标题', + 'form.title.placeholder': '给目标起个名字', + 'form.date.label': '起止日期', + 'form.date.placeholder.start': '开始日期', + 'form.date.placeholder.end': '结束日期', + 'form.goal.label': '目标描述', + 'form.goal.placeholder': '请输入你的阶段性工作目标', + 'form.standard.label': '衡量标准', + 'form.standard.placeholder': '请输入衡量标准', + 'form.client.label': '客户', + 'form.client.label.tooltip': '目标的服务对象', + 'form.client.placeholder': '请描述你服务的客户,内部客户直接 @姓名/工号', + 'form.invites.label': '邀评人', + 'form.invites.placeholder': '请直接 @姓名/工号,最多可邀请 5 人', + 'form.weight.label': '权重', + 'form.weight.placeholder': '请输入', + 'form.public.label': '目标公开', + 'form.public.label.help': '客户、邀评人默认被分享', + 'form.public.radio.public': '公开', + 'form.public.radio.partially-public': '部分公开', + 'form.public.radio.private': '不公开', + 'form.publicUsers.placeholder': '公开给', + 'form.publicUsers.option.A': '同事甲', + 'form.publicUsers.option.B': '同事乙', + 'form.publicUsers.option.C': '同事丙', 'component.globalHeader.search': '站内搜索', 'component.globalHeader.search.example1': '搜索提示一', 'component.globalHeader.search.example2': '搜索提示二', @@ -120,6 +152,9 @@ export default { 'app.analysis.table.search-keyword': '搜索关键词', 'app.analysis.table.users': '用户数', 'app.analysis.table.weekly-range': '周涨幅', + 'app.forms.basic.title': '基础表单', + 'app.forms.basic.description': + '表单页用于向用户收集或验证信息,基础表单常见于数据项较少的表单场景。', 'app.settings.menuMap.basic': '基本设置', 'app.settings.menuMap.security': '安全设置', 'app.settings.menuMap.binding': '账号绑定', diff --git a/src/pages/Forms/BasicForm.js b/src/pages/Forms/BasicForm.js index 12eca38f..55833150 100644 --- a/src/pages/Forms/BasicForm.js +++ b/src/pages/Forms/BasicForm.js @@ -1,5 +1,6 @@ import React, { PureComponent } from 'react'; import { connect } from 'dva'; +import { formatMessage, FormattedMessage } from 'umi/locale'; import { Form, Input, @@ -65,65 +66,79 @@ class BasicForms extends PureComponent { return ( } + content={} >
- + }> {getFieldDecorator('title', { rules: [ { required: true, - message: '请输入标题', + message: formatMessage({ id: 'validation.title.required' }), }, ], - })()} + })()} - + }> {getFieldDecorator('date', { rules: [ { required: true, - message: '请选择起止日期', + message: formatMessage({ id: 'validation.date.required' }), }, ], - })()} + })( + + )} - + }> {getFieldDecorator('goal', { rules: [ { required: true, - message: '请输入目标描述', + message: formatMessage({ id: 'validation.goal.required' }), }, ], })(