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 15
array|string
get(string $key, array $replace = [], string|null $locale = null, bool $fallback = true)
Get the translation for a given key.
at line 20
string
string(string $key, array $replace = [], string|null $locale = null, bool $fallback = true)
Get the specified string translation value.
at line 27
array
array(string $key, array $replace = [], string|null $locale = null, bool $fallback = true)
Get the specified array translation value.
at line 32
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 37
string
getLocale()
Get the current locale being used.
at line 42
void
setLocale(string $locale)
Set the current locale.
at line 47
string
getFallback()
Get the fallback locale being used.
at line 56
void
setFallback(string $fallback)
Set the fallback locale being used.
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.