Skip to content

API reference / Quittio \ Core \ I18n

Translations

final class in quittio/core

Quittio\Core\I18n\Translations · Source

Holds the translator used for code labels and validation messages.

The Laravel integration replaces the default with a bridge to Laravel's translator.

Methods#

MethodDescription
::reset()Drops the translator, so that the next translator() call creates a new ArrayTranslator with the core translations only (Quittio::resetState() calls it).
::translator()The translator in use; a new ArrayTranslator (locale "en") when none is set.
::use()Replaces the translator for all code labels and validation messages, e.g. with a bridge to Laravel's translator.
::version()Incremented whenever the translator is replaced, so that lazy registrations can detect it.

reset()#

public static function reset(): void

static

Drops the translator, so that the next translator() call creates a new ArrayTranslator with the core translations only (Quittio::resetState() calls it).

translator()#

public static function translator(): Translator

static

The translator in use; a new ArrayTranslator (locale "en") when none is set.

Returns
Translator

use()#

public static function use(Translator $translator): void

static

Replaces the translator for all code labels and validation messages, e.g. with a bridge to Laravel's translator.

ParameterTypeDescription
$translatorTranslator

version()#

public static function version(): int

static

Incremented whenever the translator is replaced, so that lazy registrations can detect it.

Returns
int

The open core packages are MIT licensed. The legal wording of the country packs must be confirmed by a tax adviser.