更新 'installer/client/src/core/util/validation/rules.ts'

This commit is contained in:
zhongjin 2023-05-05 22:29:42 +08:00
parent f8f46ecb4b
commit e879b0b849

View File

@ -33,7 +33,7 @@ export const required = function (
} else if (typeof value === 'object') {
return value !== null || 'Required';
} else {
return 'Required';
return '必须填写';
}
};
@ -72,7 +72,7 @@ export const digitsOnly = function (value: string): boolean | string {
return (
value == '' ||
(/^\d+$/.test(value) && !Number.isNaN(parseFloat(value))) ||
'Should be a number'
'只能是数字'
);
};
@ -82,7 +82,7 @@ export const validEmailFormat = function (value: string): boolean | string {
/^[a-zA-Z0-9.!#$%&'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+$/.test(
value,
) ||
'Expected format: admin@example.com'
'格式: admin@example.com'
);
};
@ -104,7 +104,7 @@ export const shouldNotLessThanCharLength = function (charLength: number) {
return (
!value ||
String(value).length >= charLength ||
`Should be at least ${charLength} characters`
`至少要有 ${charLength} 个字符`
);
};
};