mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-04 04:48:32 +08:00
修改 locale 的变量语法
This commit is contained in:
parent
c6d50fe6c0
commit
1945d7f7ea
@ -100,7 +100,7 @@ const advancedShortcuts = [
|
||||
regexp: /^(\d+)hoursago$/,
|
||||
resolve: (__: TranslateFn, _: string, hours: string) => {
|
||||
return {
|
||||
label: __('${hours}小时前', {hours}),
|
||||
label: __('{{hours}}小时前', {hours}),
|
||||
date: (now: moment.Moment) => {
|
||||
return now.subtract(hours, 'hours');
|
||||
}
|
||||
@ -111,7 +111,7 @@ const advancedShortcuts = [
|
||||
regexp: /^(\d+)hourslater$/,
|
||||
resolve: (__: TranslateFn, _: string, hours: string) => {
|
||||
return {
|
||||
label: __('${hours}小时后', {hours}),
|
||||
label: __('{{hours}}小时后', {hours}),
|
||||
date: (now: moment.Moment) => {
|
||||
return now.add(hours, 'hours');
|
||||
}
|
||||
@ -122,7 +122,7 @@ const advancedShortcuts = [
|
||||
regexp: /^(\d+)daysago$/,
|
||||
resolve: (__: TranslateFn, _: string, days: string) => {
|
||||
return {
|
||||
label: __('${days}天前', {days}),
|
||||
label: __('{{days}}天前', {days}),
|
||||
date: (now: moment.Moment) => {
|
||||
return now.subtract(days, 'days');
|
||||
}
|
||||
@ -133,7 +133,7 @@ const advancedShortcuts = [
|
||||
regexp: /^(\d+)dayslater$/,
|
||||
resolve: (__: TranslateFn, _: string, days: string) => {
|
||||
return {
|
||||
label: __('${days}天后', {days}),
|
||||
label: __('{{days}}天后', {days}),
|
||||
date: (now: moment.Moment) => {
|
||||
return now.add(days, 'days');
|
||||
}
|
||||
@ -144,7 +144,7 @@ const advancedShortcuts = [
|
||||
regexp: /^(\d+)weeksago$/,
|
||||
resolve: (__: TranslateFn, _: string, weeks: string) => {
|
||||
return {
|
||||
label: __('${weeks}周前', {weeks}),
|
||||
label: __('{{weeks}}周前', {weeks}),
|
||||
date: (now: moment.Moment) => {
|
||||
return now.subtract(weeks, 'weeks');
|
||||
}
|
||||
@ -155,7 +155,7 @@ const advancedShortcuts = [
|
||||
regexp: /^(\d+)weekslater$/,
|
||||
resolve: (__: TranslateFn, _: string, weeks: string) => {
|
||||
return {
|
||||
label: __('${weeks}周后', {weeks}),
|
||||
label: __('{{weeks}}周后', {weeks}),
|
||||
date: (now: moment.Moment) => {
|
||||
return now.add(weeks, 'weeks');
|
||||
}
|
||||
@ -166,7 +166,7 @@ const advancedShortcuts = [
|
||||
regexp: /^(\d+)monthsago$/,
|
||||
resolve: (__: TranslateFn, _: string, months: string) => {
|
||||
return {
|
||||
label: __('${months}月前', {months}),
|
||||
label: __('{{months}}月前', {months}),
|
||||
date: (now: moment.Moment) => {
|
||||
return now.subtract(months, 'months');
|
||||
}
|
||||
@ -177,7 +177,7 @@ const advancedShortcuts = [
|
||||
regexp: /^(\d+)monthslater$/,
|
||||
resolve: (__: TranslateFn, _: string, months: string) => {
|
||||
return {
|
||||
label: __('${months}月后', {months}),
|
||||
label: __('{{months}}月后', {months}),
|
||||
date: (now: moment.Moment) => {
|
||||
return now.add(months, 'months');
|
||||
}
|
||||
@ -188,7 +188,7 @@ const advancedShortcuts = [
|
||||
regexp: /^(\d+)quartersago$/,
|
||||
resolve: (__: TranslateFn, _: string, quarters: string) => {
|
||||
return {
|
||||
label: __('${quarters}季度前', {quarters}),
|
||||
label: __('{{quarters}}季度前', {quarters}),
|
||||
date: (now: moment.Moment) => {
|
||||
return now.subtract(quarters, 'quarters');
|
||||
}
|
||||
@ -199,7 +199,7 @@ const advancedShortcuts = [
|
||||
regexp: /^(\d+)quarterslater$/,
|
||||
resolve: (__: TranslateFn, _: string, quarters: string) => {
|
||||
return {
|
||||
label: __('${quarters}季度后', {quarters}),
|
||||
label: __('{{quarters}}季度后', {quarters}),
|
||||
date: (now: moment.Moment) => {
|
||||
return now.add(quarters, 'quarters');
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ export class CustomYearsView extends YearsView {
|
||||
«
|
||||
</th>
|
||||
<th className="rdtSwitch">
|
||||
{__('${from}年-${to}年', {from: year, to: year + 9})}
|
||||
{__('{{from}}年-{{to}}年', {from: year, to: year + 9})}
|
||||
</th>
|
||||
<th className="rdtNext" onClick={this.props.addTime(10, 'years')}>
|
||||
»
|
||||
|
@ -1,9 +1,7 @@
|
||||
// 主题管理
|
||||
import cx from 'classnames';
|
||||
// 多语言支持
|
||||
import React from 'react';
|
||||
import hoistNonReactStatic from 'hoist-non-react-statics';
|
||||
import {isObject} from './utils/helper';
|
||||
import {resolveVariable, resolveVariableAndFilter} from './utils/tpl-builtin';
|
||||
import {resolveVariable} from './utils/tpl-builtin';
|
||||
|
||||
export type TranslateFn<T = any> = (str: T, data?: object) => T;
|
||||
|
||||
@ -26,16 +24,13 @@ const fns: {
|
||||
} = {};
|
||||
|
||||
function format(str: string, data?: object) {
|
||||
return str.replace(
|
||||
/(\\)?\$([a-z0-9_.]+?)|\$\{([\s\S]+?)\}/g,
|
||||
(_, escape, key1, key2) => {
|
||||
if (escape) {
|
||||
return _.substring(1);
|
||||
}
|
||||
|
||||
return resolveVariable(key1 || key2, data || {});
|
||||
return str.replace(/(\\)?\{\{([\s\S]+?)\}\}/g, (_, escape, key) => {
|
||||
if (escape) {
|
||||
return _.substring(1);
|
||||
}
|
||||
);
|
||||
|
||||
return resolveVariable(key, data || {});
|
||||
});
|
||||
}
|
||||
|
||||
export function makeTranslator(locale?: string): TranslateFn {
|
||||
|
128
src/locale/en.ts
128
src/locale/en.ts
@ -5,7 +5,7 @@ register('en', {
|
||||
'取消': 'Cancel',
|
||||
'YYYY年': 'YYYY',
|
||||
'MM月': 'MMM',
|
||||
'${from}年-${to}年': '${from} - ${to}',
|
||||
'{{from}}年-{{to}}年': '{{from}} - {{to}}',
|
||||
'请选择日期': 'Select Date',
|
||||
'请选择日期以及时间': 'Select Datetime',
|
||||
'请选择时间': 'Select time',
|
||||
@ -14,38 +14,38 @@ register('en', {
|
||||
'点击刷新重新加载': 'Click to refresh',
|
||||
'请先选择左侧数据': 'Select from left first.',
|
||||
'请选择颜色': 'Select color',
|
||||
'现在': 'Now',
|
||||
'今天': 'Today',
|
||||
'昨天': 'Yesterday',
|
||||
'本周一': 'This monday',
|
||||
'本月初': 'Early this month',
|
||||
'上个月初': 'Early prev month',
|
||||
'上个季节初': 'Early this quarter',
|
||||
'明天': 'Tomorrow',
|
||||
'本周日': 'Last day of this week',
|
||||
'本月底': 'Last day of this month',
|
||||
'${hours}小时前': '${hours} hour(s) ago',
|
||||
'${hours}小时后': '${hours} hour(s) after',
|
||||
'${days}天前': '${days} day(s) ago',
|
||||
'${days}天后': '${days} day(s) after',
|
||||
'${weeks}周前': '${weeks} week(s) ago',
|
||||
'${weeks}周后': '${weeks} week(s) after',
|
||||
'${months}月前': '${months} month(s) ago',
|
||||
'${months}月后': '${months} month(s) after',
|
||||
'${quarters}季度前': '${quarters} quarter(s) ago',
|
||||
'${quarters}季度后': '${quarters} quarter(s) after',
|
||||
'现在': 'now',
|
||||
'今天': 'today',
|
||||
'昨天': 'yesterday',
|
||||
'本周一': 'this monday',
|
||||
'本月初': 'early this month',
|
||||
'上个月初': 'early prev month',
|
||||
'上个季节初': 'early this quarter',
|
||||
'明天': 'tomorrow',
|
||||
'本周日': 'last day of this week',
|
||||
'本月底': 'last day of this month',
|
||||
'{{hours}}小时前': '{{hours}} hour(s) ago',
|
||||
'{{hours}}小时后': '{{hours}} hour(s) after',
|
||||
'{{days}}天前': '{{days}} day(s) ago',
|
||||
'{{days}}天后': '{{days}} day(s) after',
|
||||
'{{weeks}}周前': '{{weeks}} week(s) ago',
|
||||
'{{weeks}}周后': '{{weeks}} week(s) after',
|
||||
'{{months}}月前': '{{months}} month(s) ago',
|
||||
'{{months}}月后': '{{months}} month(s) after',
|
||||
'{{quarters}}季度前': '{{quarters}} quarter(s) ago',
|
||||
'{{quarters}}季度后': '{{quarters}} quarter(s) after',
|
||||
' 至 ': ' to ',
|
||||
'最近1天': 'Last day',
|
||||
'最近7天': 'Last week',
|
||||
'最近90天': 'Last 90 days',
|
||||
'上周': 'Prev week',
|
||||
'本月': 'This month',
|
||||
'上个月': 'Prev month',
|
||||
'上个季节': 'Prev quarter',
|
||||
'本季度': 'This quarter',
|
||||
'最近1天': 'last day',
|
||||
'最近7天': 'last week',
|
||||
'最近90天': 'last 90 days',
|
||||
'上周': 'prev week',
|
||||
'本月': 'this month',
|
||||
'上个月': 'prev month',
|
||||
'上个季节': 'prev quarter',
|
||||
'本季度': 'this quarter',
|
||||
'请选择日期范围': 'Select daterange',
|
||||
'关闭': 'Close',
|
||||
'暂无选项': 'No Options',
|
||||
'暂无选项': 'No options',
|
||||
'请选择位置': 'Pick location',
|
||||
'无': 'None',
|
||||
'没有数据': 'No data',
|
||||
@ -61,27 +61,27 @@ register('en', {
|
||||
'移除该节点': 'Remove this node',
|
||||
'请输入': 'Enter',
|
||||
'请输入关键字': 'Enter keywords',
|
||||
'新增选项': 'New Option',
|
||||
'新增选项': 'New option',
|
||||
'请输入街道信息': 'Enter street info',
|
||||
'删除': 'Delete',
|
||||
'新增': 'New',
|
||||
'新增一条数据': 'Create a new data',
|
||||
'类型': 'Type',
|
||||
'拖拽排序': 'Drag to sort',
|
||||
'删除失败': 'Delete success',
|
||||
'确认要删除?': 'Are u sure to delete?',
|
||||
'组合表单成员数量不够,低于设定的最小${minLenth}个,请添加更多的成员。':
|
||||
'The count of members is less than ${minLenth}.',
|
||||
'组合表单成员数量超出,超出设定的最大${maxLength}个,请删除多余的成员。':
|
||||
'The count of members is more than ${maxLength}.',
|
||||
'子表单验证失败,请仔细检查': 'Validate failed, please check this sub-form.',
|
||||
'成员${index}': 'Member ${index}',
|
||||
'删除失败': 'Delete failed',
|
||||
'确认要删除?': 'Are you sure you want to delete?',
|
||||
'组合表单成员数量不够,低于设定的最小{{minLenth}}个,请添加更多的成员。':
|
||||
'The number of combined form members is not enough. It is lower than the minimum {{minlenth}} set. Please add more members.',
|
||||
'组合表单成员数量超出,超出设定的最大{{maxLength}}个,请删除多余的成员。':
|
||||
'The number of combined form members exceeds the set maximum of {{MaxLength}}}. Please delete the extra members.',
|
||||
'子表单验证失败,请仔细检查': 'Validate failed, please check this Subform.',
|
||||
'成员{{index}}': 'Member {{index}}',
|
||||
'清空数据': 'Clear data',
|
||||
'您选择的文件 ${filename} 大小为 ${actualSize} 超出了最大为 ${maxSize} 的限制,请重新选择。':
|
||||
'The size of ${filename} ${actualSize} is great than ${maxSize}.',
|
||||
'您选择的文件 {{filename}} 大小为 {{actualSize}} 超出了最大为 {{maxSize}} 的限制,请重新选择。':
|
||||
'The file {{filename}} you selected has a size of {actualsize}} which exceeds the maximum limit of {{maxsize}}. Please select again.',
|
||||
|
||||
'您添加的文件${files}不符合类型的`${accept}`的设定,请仔细检查。':
|
||||
'The files ${files} are not match `${accept}`, please retry.',
|
||||
'您添加的文件{{files}}不符合类型的`{{accept}}`的设定,请仔细检查。':
|
||||
'The file you added {{files}} does not match the setting of the type `{{accept}}`. Please check it carefully.',
|
||||
'把文件拖到这,然后松完成添加!':
|
||||
'Drag the file here, then release to finish adding!',
|
||||
'把图片拖到这,然后松开完成添加!':
|
||||
@ -93,19 +93,19 @@ register('en', {
|
||||
'移除': 'Remove',
|
||||
'暂停上传': 'Pause uplaod',
|
||||
'开始上传': 'Start upload',
|
||||
'已成功上传{uploaded}个文件,{failed}个文件上传失败,':
|
||||
'${uploaded} files success, ${failed} failed, ',
|
||||
'已成功上传{{uploaded}}个文件,{{failed}}个文件上传失败,':
|
||||
'Successfully uploaded {{uploaded}} files, failed to upload {{failed}} files,',
|
||||
'失败文件': 'failed files.',
|
||||
'高度${height}px': 'height: ${height}px',
|
||||
'宽度${width}px': 'width: ${width}px',
|
||||
'尺寸(${width} x ${height})': 'size: (${width}px x ${height}px)',
|
||||
'您选择的图片不符合尺寸要求, 请上传${info}的图片':
|
||||
'The picture you selected does not meet the size requirements. Please upload the picture of ${info}',
|
||||
'您选择的图片不符合尺寸要求, 请上传不要超过${info}的图片':
|
||||
'The picture you selected does not meet the size requirements. Please upload a picture that does not exceed ${info}`.',
|
||||
'您选择的图片不符合尺寸要求, 请上传不要小于${info}的图片':
|
||||
'The picture you selected does not meet the size requirements. Please upload a picture no less than ${info}',
|
||||
'您选择的图片不符合尺寸要求, 请上传尺寸比率为 ${ratio} 的图片':
|
||||
'高度{{height}}px': 'height: {{height}}px',
|
||||
'宽度{{width}}px': 'width: {{width}}px',
|
||||
'尺寸({{width}} x {{height}})': 'size: ({{width}}px x {{height}}px)',
|
||||
'您选择的图片不符合尺寸要求, 请上传{{info}}的图片':
|
||||
'The picture you selected does not meet the size requirements. Please upload the picture of {{info}}',
|
||||
'您选择的图片不符合尺寸要求, 请上传不要超过{{info}}的图片':
|
||||
'The picture you selected does not meet the size requirements. Please upload a picture that does not exceed {{info}}`.',
|
||||
'您选择的图片不符合尺寸要求, 请上传不要小于{{info}}的图片':
|
||||
'The picture you selected does not meet the size requirements. Please upload a picture no less than {{info}}',
|
||||
'您选择的图片不符合尺寸要求, 请上传尺寸比率为 {{ratio}} 的图片':
|
||||
'The picture you selected does not meet the size requirements. Please upload the picture with the size ratio of ${ration}',
|
||||
'文件上传失败请重试': 'File upload failed, please try again',
|
||||
'文件上传中': 'File uploading',
|
||||
@ -115,24 +115,24 @@ register('en', {
|
||||
'The current state supports pasting picture files from the clipboard.',
|
||||
'表单': 'Form',
|
||||
'提交': 'Submit',
|
||||
'初始化失败': 'initialization failed',
|
||||
'初始化失败': 'Initialization failed',
|
||||
'保存成功': 'Saved successfully',
|
||||
'保存失败': 'Save failed',
|
||||
'依赖的部分字段没有通过验证,请注意填写!':
|
||||
'Some of the dependent fields failed to pass the verification, please fill in!',
|
||||
'请输入名称': 'Please enter a name',
|
||||
'编辑${label}': 'Edit ${label}',
|
||||
'编辑{{label}}': 'Edit {{label}}',
|
||||
'每': 'Per',
|
||||
'编辑详情': 'Detail',
|
||||
'删除当前行': 'Delete current row',
|
||||
'操作': 'Operation',
|
||||
'新增一行': 'Add a new row',
|
||||
'暂无标签': 'No tag yet',
|
||||
'新增:${label}': 'New ${label}',
|
||||
'新增:{{label}}': 'New {{label}}',
|
||||
'顶级': 'Root',
|
||||
'点击复制': 'Copy',
|
||||
'${page}/${lastPage} 总共:${total} 项。':
|
||||
'${page} of ${lastPage} total: ${total}.',
|
||||
'{{page}}/{{lastPage}} 总共:{{total}} 项。':
|
||||
'{{page}} of {{lastPage}} total: {{total}}.',
|
||||
'每页显示': 'Per page',
|
||||
'加载更多': 'Load more',
|
||||
'筛选': 'Filter',
|
||||
@ -140,11 +140,11 @@ register('en', {
|
||||
'日期无效': 'Invalid date',
|
||||
'关闭弹窗': 'Close',
|
||||
'链接': 'Link',
|
||||
'当前有 ${modified} 条记录修改了内容, 但并没有提交。请选择:':
|
||||
'There are currently ${modified} records that have modified the contents, but they have not been submitted. Please select:',
|
||||
'当前有 {{modified}} 条记录修改了内容, 但并没有提交。请选择:':
|
||||
'There are currently {{modified}} records that have modified the contents, but they have not been submitted. Please select:',
|
||||
'放弃': 'Give up',
|
||||
'当前有 ${moved} 条记录修改了顺序, 但并没有提交。请选择:':
|
||||
'There are currently ${moved} records that have changed the order, but have not been committed. Please select:',
|
||||
'当前有 {{moved}} 条记录修改了顺序, 但并没有提交。请选择:':
|
||||
'There are currently {{moved}} records that have changed the order, but have not been committed. Please select:',
|
||||
'点击开始排序': 'Click to start sorting',
|
||||
'请拖动左边的按钮进行排序': 'Please drag the button on the left to sort',
|
||||
'排序': 'Sort',
|
||||
|
@ -1343,7 +1343,7 @@ export default class CRUD extends React.Component<CRUDProps, any> {
|
||||
|
||||
return (
|
||||
<div className={cx('Crud-statistics')}>
|
||||
{__('${page}/${lastPage} 总共:${total} 项。', {
|
||||
{__('{{page}}/{{lastPage}} 总共:{{total}} 项。', {
|
||||
page: store.page,
|
||||
lastPage: store.lastPage,
|
||||
total: store.total
|
||||
|
@ -493,13 +493,13 @@ export default class ComboControl extends React.Component<ComboProps> {
|
||||
if (minLength && (!Array.isArray(value) || value.length < minLength)) {
|
||||
return __(
|
||||
(messages && messages.minLengthValidateFailed) ||
|
||||
'组合表单成员数量不够,低于设定的最小${minLenth}个,请添加更多的成员。',
|
||||
'组合表单成员数量不够,低于设定的最小{{minLenth}}个,请添加更多的成员。',
|
||||
{minLength}
|
||||
);
|
||||
} else if (maxLength && Array.isArray(value) && value.length > maxLength) {
|
||||
return __(
|
||||
(messages && messages.maxLengthValidateFailed) ||
|
||||
'组合表单成员数量超出,超出设定的最大${maxLength}个,请删除多余的成员。',
|
||||
'组合表单成员数量超出,超出设定的最大{{maxLength}}个,请删除多余的成员。',
|
||||
{maxLength}
|
||||
);
|
||||
} else if (this.subForms.length && (!nullable || value)) {
|
||||
@ -849,7 +849,7 @@ export default class ComboControl extends React.Component<ComboProps> {
|
||||
<Tab
|
||||
title={filter(
|
||||
tabsLabelTpl ||
|
||||
__('成员${index}', {index: (data as any).index + 1}),
|
||||
__('成员{{index}}', {index: (data as any).index + 1}),
|
||||
data
|
||||
)}
|
||||
key={this.keys[index] || (this.keys[index] = guid())}
|
||||
|
@ -283,7 +283,7 @@ export default class FileControl extends React.Component<FileProps, FileState> {
|
||||
if (maxSize && file.size > maxSize) {
|
||||
this.props.env.alert(
|
||||
__(
|
||||
'您选择的文件 ${filename} 大小为 ${actualSize} 超出了最大为 ${maxSize} 的限制,请重新选择。',
|
||||
'您选择的文件 {{filename}} 大小为 {{actualSize}} 超出了最大为 {{maxSize}} 的限制,请重新选择。',
|
||||
{
|
||||
filename: file.name,
|
||||
actualSize: ImageControl.formatFileSize(file.size),
|
||||
@ -341,7 +341,7 @@ export default class FileControl extends React.Component<FileProps, FileState> {
|
||||
});
|
||||
|
||||
env.alert(
|
||||
__('您添加的文件${files}不符合类型的`${accept}`的设定,请仔细检查。', {
|
||||
__('您添加的文件{{files}}不符合类型的`{{accept}}`的设定,请仔细检查。', {
|
||||
files: files.map((item: any) => `「${item.name}」`).join(' '),
|
||||
accept
|
||||
})
|
||||
@ -1028,7 +1028,7 @@ export default class FileControl extends React.Component<FileProps, FileState> {
|
||||
|
||||
{failed ? (
|
||||
<div className={cx('FileControl-sum')}>
|
||||
{__('已成功上传{uploaded}个文件,{failed}个文件上传失败,', {
|
||||
{__('已成功上传{{uploaded}}个文件,{{failed}}个文件上传失败,', {
|
||||
uploaded,
|
||||
failed
|
||||
})}
|
||||
|
@ -146,12 +146,12 @@ export default class ImageControl extends React.Component<
|
||||
__: TranslateFn
|
||||
): string {
|
||||
if (!width) {
|
||||
return __('高度${height}px', {height: height});
|
||||
return __('高度{{height}}px', {height: height});
|
||||
} else if (!height) {
|
||||
return __('宽度${width}px', {width: width});
|
||||
return __('宽度{{width}}px', {width: width});
|
||||
}
|
||||
|
||||
return __('尺寸(${width} x ${height})', {width, height});
|
||||
return __('尺寸({{width}} x {{height}})', {width, height});
|
||||
}
|
||||
|
||||
state: ImageState = {
|
||||
@ -323,7 +323,7 @@ export default class ImageControl extends React.Component<
|
||||
// });
|
||||
|
||||
env.alert(
|
||||
__('您添加的文件${files}不符合类型的`${accept}`的设定,请仔细检查。', {
|
||||
__('您添加的文件{{files}}不符合类型的`{{accept}}`的设定,请仔细检查。', {
|
||||
files: files.map((file: any) => `「${file.name}」`).join(' '),
|
||||
accept
|
||||
})
|
||||
@ -658,7 +658,7 @@ export default class ImageControl extends React.Component<
|
||||
if (maxSize && file.size > maxSize) {
|
||||
alert(
|
||||
__(
|
||||
'您选择的文件 ${filename} 大小为 ${actualSize} 超出了最大为 ${maxSize} 的限制,请重新选择。',
|
||||
'您选择的文件 {{filename}} 大小为 {{actualSize}} 超出了最大为 {{maxSize}} 的限制,请重新选择。',
|
||||
{
|
||||
filename: file.name,
|
||||
actualSize: ImageControl.formatFileSize(file.size),
|
||||
@ -718,21 +718,21 @@ export default class ImageControl extends React.Component<
|
||||
(limit.width && limit.width != width) ||
|
||||
(limit.height && limit.height != height)
|
||||
) {
|
||||
error = __('您选择的图片不符合尺寸要求, 请上传${info}的图片', {
|
||||
error = __('您选择的图片不符合尺寸要求, 请上传{{info}}的图片', {
|
||||
info: ImageControl.sizeInfo(limit.width, limit.height, __)
|
||||
});
|
||||
} else if (
|
||||
(limit.maxWidth && limit.maxWidth < width) ||
|
||||
(limit.maxHeight && limit.maxHeight < height)
|
||||
) {
|
||||
error = __('您选择的图片不符合尺寸要求, 请上传不要超过${info}的图片', {
|
||||
error = __('您选择的图片不符合尺寸要求, 请上传不要超过{{info}}的图片', {
|
||||
info: ImageControl.sizeInfo(limit.maxWidth, limit.maxHeight, __)
|
||||
});
|
||||
} else if (
|
||||
(limit.minWidth && limit.minWidth > width) ||
|
||||
(limit.minHeight && limit.minHeight > height)
|
||||
) {
|
||||
error = __('您选择的图片不符合尺寸要求, 请上传不要小于${info}的图片', {
|
||||
error = __('您选择的图片不符合尺寸要求, 请上传不要小于{{info}}的图片', {
|
||||
info: ImageControl.sizeInfo(limit.minWidth, limit.minHeight, __)
|
||||
});
|
||||
} else if (
|
||||
@ -740,7 +740,7 @@ export default class ImageControl extends React.Component<
|
||||
Math.abs(width / height - limit.aspectRatio) > 0.01
|
||||
) {
|
||||
error = __(
|
||||
'您选择的图片不符合尺寸要求, 请上传尺寸比率为 ${ratio} 的图片',
|
||||
'您选择的图片不符合尺寸要求, 请上传尺寸比率为 {{ratio}} 的图片',
|
||||
{
|
||||
ratio: limit.aspectRatioLabel || limit.aspectRatio
|
||||
}
|
||||
|
@ -675,7 +675,7 @@ export function registerOptionsControl(config: OptionsConfig) {
|
||||
: await onOpenDialog(
|
||||
{
|
||||
type: 'dialog',
|
||||
title: __('编辑${label}', {
|
||||
title: __('编辑{{label}}', {
|
||||
label: optionLabel || '选项'
|
||||
}),
|
||||
body: {
|
||||
|
@ -107,12 +107,12 @@ export default class FormTable extends React.Component<TableProps, TableState> {
|
||||
|
||||
if (minLength && (!Array.isArray(value) || value.length < minLength)) {
|
||||
return __(
|
||||
'组合表单成员数量不够,低于设定的最小${minLenth}个,请添加更多的成员。',
|
||||
'组合表单成员数量不够,低于设定的最小{{minLenth}}个,请添加更多的成员。',
|
||||
{minLength}
|
||||
);
|
||||
} else if (maxLength && Array.isArray(value) && value.length > maxLength) {
|
||||
return __(
|
||||
'组合表单成员数量超出,超出设定的最大${maxLength}个,请删除多余的成员。',
|
||||
'组合表单成员数量超出,超出设定的最大{{maxLength}}个,请删除多余的成员。',
|
||||
{maxLength}
|
||||
);
|
||||
} else {
|
||||
|
@ -543,7 +543,7 @@ export default class TextControl extends React.PureComponent<
|
||||
>
|
||||
{option.isNew ? (
|
||||
<span>
|
||||
{__('新增:${label}', {label: option.label})}
|
||||
{__('新增:{{label}}', {label: option.label})}
|
||||
<Icon icon="enter" className="icon" />
|
||||
</span>
|
||||
) : (
|
||||
|
@ -132,15 +132,21 @@ export default class TreeSelectControl extends React.Component<
|
||||
}
|
||||
|
||||
validate(): any {
|
||||
const {value, minLength, maxLength, delimiter} = this.props;
|
||||
const {value, minLength, maxLength, delimiter, translate: __} = this.props;
|
||||
|
||||
let curValue = Array.isArray(value)
|
||||
? value
|
||||
: (value ? String(value) : '').split(delimiter || ',');
|
||||
if (minLength && curValue.length < minLength) {
|
||||
return `已选择数量低于设定的最小个数${minLength},请选择更多的选项。`;
|
||||
return __(
|
||||
'已选择数量低于设定的最小个数${minLength},请选择更多的选项。',
|
||||
{minLength}
|
||||
);
|
||||
} else if (maxLength && curValue.length > maxLength) {
|
||||
return `已选择数量超出设定的最大个数${maxLength},请取消选择超出的选项。`;
|
||||
return __(
|
||||
'已选择数量超出设定的最大个数{{maxLength}},请取消选择超出的选项。',
|
||||
{maxLength}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -973,7 +973,7 @@ export default class Table extends React.Component<TableProps, object> {
|
||||
{!saveImmediately && store.modified && !hideQuickSaveBtn ? (
|
||||
<span>
|
||||
{__(
|
||||
'当前有 ${modified} 条记录修改了内容, 但并没有提交。请选择:',
|
||||
'当前有 {{modified}} 条记录修改了内容, 但并没有提交。请选择:',
|
||||
{
|
||||
modified: store.modified
|
||||
}
|
||||
@ -997,7 +997,7 @@ export default class Table extends React.Component<TableProps, object> {
|
||||
</span>
|
||||
) : store.moved ? (
|
||||
<span>
|
||||
{__('当前有 ${moved} 条记录修改了顺序, 但并没有提交。请选择:', {
|
||||
{__('当前有 {{moved}} 条记录修改了顺序, 但并没有提交。请选择:', {
|
||||
moved: store.moved
|
||||
})}
|
||||
<button
|
||||
|
Loading…
Reference in New Issue
Block a user