verificator
Version:
Client and server-side validation JavaScript library
58 lines (56 loc) • 7.59 kB
text/typescript
export const messages = {
accepted: ({ attribute }: any) => `Вы должны принять ${attribute}.`,
after: ({ attribute, parameters: [ date ] }: any) => `В поле ${attribute} должна быть дата после ${date}.`,
after_or_equal: ({ attribute, parameters: [ date ] }: any) => `В поле ${attribute} должна быть дата после или равняться ${date}.`,
alpha: ({ attribute }: any) => `Поле ${attribute} может содержать только буквы.`,
alpha_dash: ({ attribute }: any) => `Поле ${attribute} может содержать только буквы, цифры и дефис.`,
alpha_num: ({ attribute }: any) => `Поле ${attribute} может содержать только буквы и цифры.`,
array: ({ attribute }: any) => `Поле ${attribute} должно быть массивом.`,
before: ({ attribute, parameters: [ date ] }: any) => `В поле ${attribute} должна быть дата до ${date}.`,
before_or_equal: ({ attribute, parameters: [ date ] }: any) => `В поле ${attribute} должна быть дата до или равняться ${date}.`,
'between:numeric': ({ attribute, parameters: [ min, max ] }: any) => `Поле ${attribute} должно быть между ${min} и ${max}.`,
'between:string': ({ attribute, parameters: [ min, max ] }: any) => `Количество символов в поле ${attribute} должно быть между ${min} и ${max}.`,
'between:array': ({ attribute, parameters: [ min, max ] }: any) => `Количество элементов в поле ${attribute} должно быть между ${min} и ${max}.`,
boolean: ({ attribute }: any) => `Поле ${attribute} должно иметь значение логического типа.`,
confirmed: ({ attribute }: any) => `Поле ${attribute} не совпадает с подтверждением.`,
date: ({ attribute }: any) => `Поле ${attribute} не является датой.`,
date_equals: ({ attribute, parameters: [ date ] }: any) => `В поле ${attribute} должна быть дата равная ${date}.`,
date_format: ({ attribute, parameters: [ format ] }: any) => `Поле ${attribute} не соответствует формату ${format}.`,
different: ({ attribute, parameters: [ other ] }: any) => `Поля ${attribute} и ${other} должны различаться.`,
digits: ({ attribute, parameters: [ digits ] }: any) => `Длина цифрового поля ${attribute} должна быть ${digits}.`,
digits_between: ({ attribute, parameters: [ min, max ] }: any) => `Длина цифрового поля ${attribute} должна быть между ${min} и ${max}.`,
distinct: ({ attribute }: any) => `Поле ${attribute} содержит повторяющееся значение.`,
email: ({ attribute }: any) => `Поле ${attribute} должно быть действительным электронным адресом.`,
filled: ({ attribute }: any) => `Поле ${attribute} обязательно для заполнения.`,
in: ({ attribute }: any) => `Выбранное значение для ${attribute} ошибочно.`,
in_array: ({ attribute, parameters: [ other ] }: any) => `Поле ${attribute} не существует в ${other}.`,
integer: ({ attribute }: any) => `Поле ${attribute} должно быть целым числом.`,
ip: ({ attribute }: any) => `Поле ${attribute} должно быть действительным IP-адресом.`,
ipv4: ({ attribute }: any) => `Поле ${attribute} должно быть действительным IPv4-адресом.`,
ipv6: ({ attribute }: any) => `Поле ${attribute} должно быть действительным IPv6-адресом.`,
json: ({ attribute }: any) => `Поле ${attribute} должно быть JSON строкой.`,
'max:numeric': ({ attribute, parameters: [ max ] }: any) => `Поле ${attribute} не может быть более ${max}.`,
'max:string': ({ attribute, parameters: [ max ] }: any) => `Количество символов в поле ${attribute} не может превышать ${max}.`,
'max:array': ({ attribute, parameters: [ max ] }: any) => `Количество элементов в поле ${attribute} не может превышать ${max}.`,
'min:numeric': ({ attribute, parameters: [ min ] }: any) => `Поле ${attribute} должно быть не менее ${min}.`,
'min:string': ({ attribute, parameters: [ min ] }: any) => `Количество символов в поле ${attribute} должно быть не менее ${min}.`,
'min:array': ({ attribute, parameters: [ min ] }: any) => `Количество элементов в поле ${attribute} должно быть не менее ${min}.`,
not_in: ({ attribute }: any) => `Выбранное значение для ${attribute} ошибочно.`,
numeric: ({ attribute }: any) => `Поле ${attribute} должно быть числом.`,
present: ({ attribute }: any) => `Поле ${attribute} должно присутствовать.`,
regex: ({ attribute }: any) => `Поле ${attribute} имеет ошибочный формат.`,
required: ({ attribute }: any) => `Поле ${attribute} обязательно для заполнения.`,
required_if: ({ attribute, parameters: [ other, value ] }: any) => `Поле ${attribute} обязательно для заполнения, когда ${other} равно ${value}.`,
required_unless: ({ attribute, parameters: [ other, value ] }: any) => `Поле ${attribute} обязательно для заполнения, когда ${other} не равно ${value}.`,
required_with: ({ attribute, parameters }: any) => `Поле ${attribute} обязательно для заполнения, когда ${parameters.join(' / ')} указано.`,
required_with_all: ({ attribute, parameters }: any) => `Поле ${attribute} обязательно для заполнения, когда ${parameters.join(' / ')} указано.`,
required_without: ({ attribute, parameters }: any) => `Поле ${attribute} обязательно для заполнения, когда ${parameters.join(' / ')} не указано.`,
required_without_all: ({ attribute, parameters }: any) => `Поле ${attribute} обязательно для заполнения, когда ни одно из ${parameters.join(' / ')} не указано.`,
same: ({ attribute, parameters: [ other ] }: any) => `Значение ${attribute} должно совпадать с ${other}.`,
'size:numeric': ({ attribute, parameters: [ size ] }: any) => `Поле ${attribute} должно быть равным ${size}.`,
'size:string': ({ attribute, parameters: [ size ] }: any) => `Количество символов в поле ${attribute} должно быть равным ${size}.`,
'size:array': ({ attribute, parameters: [ size ] }: any) => `Количество элементов в поле ${attribute} должно быть равным ${size}.`,
string: ({ attribute }: any) => `Поле ${attribute} должно быть строкой.`,
url: ({ attribute }: any) => `Поле ${attribute} имеет ошибочный формат.`,
}
export const attributes = {}