PotentiallyTranslatedString
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
$this
translate(array $replace = [], string|null $locale = null)
Translate the string.
$this
translateChoice(Countable|int|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.
$this
translate(array $replace = [], string|null $locale = null)
Translate the string.
$this
translateChoice(Countable|int|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.