Translator
interface Translator
Methods
Get the translation for a given key.
Get the specified string translation value.
Get the specified array translation value.
Get the current locale being used.
Set the current locale.
Get the fallback locale being used.
Set the fallback locale being used.
Details
at line 14
array|string
get(string $key, array $replace = [], string|null $locale = null, bool $fallback = true)
Get the translation for a given key.
at line 19
string
string(string $key, array $replace = [], string|null $locale = null, bool $fallback = true)
Get the specified string translation value.
at line 26
array
array(string $key, array $replace = [], string|null $locale = null, bool $fallback = true)
Get the specified array translation value.
at line 31
string
choice(string $key, array|Countable|float|int $number, array $replace = [], string|null $locale = null)
Get a translation according to an integer value.
at line 36
string
getLocale()
Get the current locale being used.
at line 41
void
setLocale(string $locale)
Set the current locale.
at line 46
string
getFallback()
Get the fallback locale being used.
at line 55
void
setFallback(string $fallback)
Set the fallback locale being used.
Boot-only. The fallback is shared by the worker's Translator instance and affects every subsequent translation lookup in that worker. Use setLocale() for a current-request locale override.