class UsedTranslationViewCollector

Traits

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.

Constants

private COMPONENT_TAG_REGEX

Component tags, whose attributes are matched as Blade matches them.

private BOUND_ATTRIBUTE_REGEX

Component attributes bound with a single colon or bind:, whose values are PHP expressions.

private ECHO_REGEXES

Echoes in Blade's compile order: raw, escaped, then regular. An @ prefix leaves an echo as text.

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.

__construct(ViewParser $viewParser, BladeScanner $bladeScanner, ViewFileHelper $viewFileHelper, Filesystem $filesystem)

Create a new collector instance.

array
getUsedTranslations()

Get the translations looked up by the root views, keyed by view file.

Details

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

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

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

at line 83
__construct(ViewParser $viewParser, BladeScanner $bladeScanner, ViewFileHelper $viewFileHelper, Filesystem $filesystem)

Create a new collector instance.

Parameters

ViewParser $viewParser
BladeScanner $bladeScanner
ViewFileHelper $viewFileHelper
Filesystem $filesystem

at line 96
array getUsedTranslations()

Get the translations looked up by the root views, keyed by view file.

Return Value

array