class Translator extends NamespacedItemResolver implements Translator (View source)
Macroable |
array | parseKey(string $key) Parse a key into namespace, group, and item. | |
void | setParsedKey(string $key, array $parsed) Set the parsed value of a key. | from NamespacedItemResolver |
static void | macro(string $name, callable $macro) Register a custom macro. | from Macroable |
static bool | hasMacro(string $name) Checks if macro is registered. | from Macroable |
static mixed | __callStatic(string $method, array $parameters) Dynamically handle calls to the class. | from Macroable |
mixed | __call(string $method, array $parameters) Dynamically handle calls to the class. | from Macroable |
void | __construct(LoaderInterface $loader, string $locale) Create a new translator instance. | |
bool | hasForLocale(string $key, string|null $locale = null) Determine if a translation exists for a given locale. | |
bool | has(string $key, string|null $locale = null, bool $fallback = true) Determine if a translation exists. | |
mixed | trans(string $key, array $replace = array(), string $locale = null) Get the translation for a given key. | |
string|array|null | get(string $key, array $replace = array(), string|null $locale = null, bool $fallback = true) Get the translation for the given key. | |
string | getFromJson(string $key, array $replace = array(), string $locale = null) Get the translation for a given key from the JSON translation files. | |
string | transChoice(string $key, int|array|Countable $number, array $replace = array(), string $locale = null) Get a translation according to an integer value. | |
string | choice(string $key, int|array|Countable $number, array $replace = array(), string $locale = null) Get a translation according to an integer value. | |
void | addLines(array $lines, string $locale, string $namespace = '*') Add translation lines to the given locale. | |
void | load(string $namespace, string $group, string $locale) Load the specified language group. | |
void | addNamespace(string $namespace, string $hint) Add a new namespace to the loader. | |
MessageSelector | getSelector() Get the message selector instance. | |
void | setSelector(MessageSelector $selector) Set the message selector instance. | |
LoaderInterface | getLoader() Get the language line loader implementation. | |
string | locale() Get the default locale being used. | |
string | getLocale() Get the default locale being used. | |
void | setLocale(string $locale) Set the default locale. | |
string | getFallback() Get the fallback locale being used. | |
void | setFallback(string $fallback) Set the fallback locale being used. |
Parse a key into namespace, group, and item.
Set the parsed value of a key.
Register a custom macro.
Checks if macro is registered.
Dynamically handle calls to the class.
Dynamically handle calls to the class.
Create a new translator instance.
Determine if a translation exists for a given locale.
Determine if a translation exists.
Get the translation for a given key.
Get the translation for the given key.
Get the translation for a given key from the JSON translation files.
Get a translation according to an integer value.
Get a translation according to an integer value.
Add translation lines to the given locale.
Load the specified language group.
Add a new namespace to the loader.
Get the message selector instance.
Set the message selector instance.
Get the language line loader implementation.
Get the default locale being used.
Get the default locale being used.
Set the default locale.
Get the fallback locale being used.
Set the fallback locale being used.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/5.4/Illuminate/Translation/Translator.html