trait I18nAwareTrait

I18n aware trait.

Properties

protected I18n $i18n I18n.

Methods

setI18n(I18n $i18n)

Sets the I18n instance.

string
translateFieldName(string $field, string $package)

Returns a translated field name.

array
getI18nParameters(string $field, string $package)

Gets the i18n parameters.

string
getErrorMessage(string $field)

Returns an error message.

string
getTranslatedErrorMessage(string $field, string $rule, string|null $package = null)

Returns the translated error message.

Details

at line 42
I18nAwareInterface setI18n(I18n $i18n)

Sets the I18n instance.

Parameters

I18n $i18n I18n

Return Value

I18nAwareInterface

at line 56
protected string translateFieldName(string $field, string $package)

Returns a translated field name.

Parameters

string $field Field name
string $package Package prefix

Return Value

string

at line 77
protected array getI18nParameters(string $field, string $package)

Gets the i18n parameters.

Parameters

string $field Field name
string $package Package prefix

Return Value

array

at line 106
abstract string getErrorMessage(string $field)

Returns an error message.

Parameters

string $field Field name

Return Value

string

at line 116
string getTranslatedErrorMessage(string $field, string $rule, string|null $package = null)

Returns the translated error message.

Parameters

string $field Field name
string $rule Rule name
string|null $package Package name

Return Value

string