Skip to content

API reference / Quittio \ Core \ I18n

Translator

interface in quittio/core

Quittio\Core\I18n\Translator · Source

Minimal translator contract so that the core works without Laravel. Keys use the form "group.key" (e.g. "labels.due_date", "rules.BR-CO-25.message").

Methods#

MethodDescription
->addPath()Registers a directory with {locale}/{group}.php files for a namespace (e.g. "quittio-de").
->get()
->has()
->locale()

addPath()#

public function addPath(string $path, string $namespace = '*'): self

Registers a directory with {locale}/{group}.php files for a namespace (e.g. "quittio-de").

ParameterTypeDescription
$pathstring
$namespacestring = '*'
Returns
self

get()#

public function get(
    string $key,
    array<string, string|int> $replace = [],
    ?string $locale = null,
): string
ParameterTypeDescription
$keystring
$replacearray<string, string|int> = []
$locale?string = null
Returns
string

has()#

public function has(string $key, ?string $locale = null): bool
ParameterTypeDescription
$keystring
$locale?string = null
Returns
bool

locale()#

public function locale(): string
Returns
string

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