verificator
Version:
Client and server-side validation JavaScript library
22 lines (21 loc) • 1.15 kB
TypeScript
import Validator from './Validator';
import { Items, Locale, Message, MessageParameters, Messages } from './types';
export default class Translator {
protected _validator: Validator;
protected _messages: Items<Message>;
protected _attributes: Items<string>;
protected _customMessages: Items<Message>;
protected _customAttributes: Items<string>;
constructor(locale: Locale, validator: Validator);
setLocale(locale: Locale): this;
getAttribute(attribute: string): string | null;
getMessage(rule: string, attribute: string, value: any, parameters: any[]): string;
setCustomMessages(messages?: Messages): this;
addCustomMessages(messages?: Messages): this;
setCustomAttributes(attributes?: Items<string>): this;
addCustomAttributes(attributes?: Items<string>): this;
protected _findMessage(source: Items<string | Function>, attribute: string, parameters: MessageParameters): string | null;
protected _getDisplayableAttribute(attribute: string): string;
protected _getDisplayableParameters(rule: string, parameters: any[]): any[];
protected _getAttributeType(attribute: string): string;
}