trait CollectsTranslationLookups

internal  
 

Upstream collects only the key. The missing-translation rule resolves each lookup through the booted translator, so the call's locale, fallback and operation are collected with it.

Methods

array|null
translationLookup(CallLike $call, bool $choice, bool $acceptsFallback, Scope|null $scope)

Get the lookup made by a call with a literal translation key.

array|null
translationLocales(Expr|null $locale, Scope|null $scope)

Get the locales a lookup can use, where null is the translator's current locale.

bool
translationFallback(Expr|null $fallback, Scope|null $scope)

Determine whether a lookup can use the fallback locale.

Details

at line 34
protected array|null translationLookup(CallLike $call, bool $choice, bool $acceptsFallback, Scope|null $scope)

Get the lookup made by a call with a literal translation key.

Parameters

CallLike $call
bool $choice

whether the call is a choice() lookup, whose locale follows the count

bool $acceptsFallback

whether the call has get()'s fallback parameter

Scope|null $scope

Return Value

array|null

at line 71
protected array|null translationLocales(Expr|null $locale, Scope|null $scope)

Get the locales a lookup can use, where null is the translator's current locale.

Parameters

Expr|null $locale
Scope|null $scope

Return Value

array|null

at line 107
protected bool translationFallback(Expr|null $fallback, Scope|null $scope)

Determine whether a lookup can use the fallback locale.

An unknown value counts as true: a translation missing with the fallback locale is also missing without it.

Parameters

Expr|null $fallback
Scope|null $scope

Return Value

bool