class PotentiallyTranslatedString implements Stringable (View source)

Properties

protected string $string

The string that may be translated.

protected string|null $translation

The translated string.

protected Translator $translator

The validator that may perform the translation.

Methods

__construct(string $string, Translator $translator)

Create a new potentially translated string.

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

Translate the string.

$this
translateChoice(Countable|int|float|array $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

__construct(string $string, Translator $translator)

Create a new potentially translated string.

Parameters

string $string
Translator $translator

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

Translate the string.

Parameters

array $replace
string|null $locale

Return Value

$this

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

Translates the string based on a count.

Parameters

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

Return Value

$this

string original()

Get the original string.

Return Value

string

string __toString()

Get the potentially translated string.

Return Value

string

string toString()

Get the potentially translated string.

Return Value

string