class PotentiallyTranslatedString implements Stringable

Properties

protected string|null $translation

The translated string.

Methods

__construct(string $string, Translator $translator)

Create a new potentially translated string.

translate(array $replace = [], string|null $locale = null)

Translate the string.

translateChoice(array|Countable|float|int $number, array $replace = [], string|null $locale = null)

Translates the string based on a count.

string
original()

Get the original string.

string
__toString()

Get the potentially translated string.

string
toString()

Get the potentially translated string.

Details

at line 24
__construct(string $string, Translator $translator)

Create a new potentially translated string.

Parameters

string $string

the string that may be translated

Translator $translator

the validator that may perform the translation

at line 33
PotentiallyTranslatedString translate(array $replace = [], string|null $locale = null)

Translate the string.

Parameters

array $replace
string|null $locale

Return Value

PotentiallyTranslatedString

at line 43
PotentiallyTranslatedString translateChoice(array|Countable|float|int $number, array $replace = [], string|null $locale = null)

Translates the string based on a count.

Parameters

array|Countable|float|int $number
array $replace
string|null $locale

Return Value

PotentiallyTranslatedString

at line 53
string original()

Get the original string.

Return Value

string

at line 61
string __toString()

Get the potentially translated string.

Return Value

string

at line 69
string toString()

Get the potentially translated string.

Return Value

string