Translator

interface Translator (View source)

Methods

mixed trans(string $key, array $replace = [], string|null $locale = null)

Get the translation for a given key.

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

Get a translation according to an integer value.

string getLocale()

Get the default locale being used.

void setLocale(string $locale)

Set the default locale.

Details

mixed trans(string $key, array $replace = [], string|null $locale = null)

Get the translation for a given key.

Parameters

string $key
array $replace
string|null $locale

Return Value

mixed

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

Get a translation according to an integer value.

Parameters

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

Return Value

string

string getLocale()

Get the default locale being used.

Return Value

string

void setLocale(string $locale)

Set the default locale.

Parameters

string $locale

Return Value

void

© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/5.8/Illuminate/Contracts/Translation/Translator.html