October\Rain\Translation\Translator

Extends:

  • Illuminate\Translation\Translator
  • Illuminate\Support\NamespacedItemResolver

Implements:

  • Illuminate\Contracts\Translation\Translator

Translator class

Protected properties

protected October\Rain\Events\Dispatcher $events

events dispatcher instance

Show inherited protected properties

Inherited protected properties

  • protected Illuminate\Contracts\Translation\Loader $loader - defined in Illuminate\Translation\Translator. The loader implementation.
  • protected string $locale - defined in Illuminate\Translation\Translator. The default locale being used by the translator.
  • protected string $fallback - defined in Illuminate\Translation\Translator. The fallback locale used by the translator.
  • protected array $loaded - defined in Illuminate\Translation\Translator. The array of loaded translation groups.
  • protected Illuminate\Translation\MessageSelector $selector - defined in Illuminate\Translation\Translator. The message selector.
  • protected array $parsed - defined in Illuminate\Support\NamespacedItemResolver. A cache of the parsed items.
  • protected static array $macros - defined in Illuminate\Translation\Translator. The registered string macros.

Public methods

public void get($key, $replace=array(), $locale=NULL, $fallback=true)

get the translation for the given key.

Parameters
  • $key
  • $replace
  • $locale
  • $fallback

public void setEventDispatcher($events)

setEventDispatcher instance

Parameters
  • $events

public string trans(array|string $id, array $parameters=array(), string $locale=NULL)

trans returns the translation for a given key

Parameters
  • array|string $id
  • array $parameters
  • string $locale

public string transChoice(string $id, int $number, array $parameters=array(), string $locale=NULL)

transChoice gets a translation according to an integer value

Parameters
  • string $id
  • int $number
  • array $parameters
  • string $locale

Show inherited public methods

Inherited public methods

  • public mixed __call(string $method, array $parameters) - defined in Illuminate\Translation\Translator. Dynamically handle calls to the class.
  • public static mixed __callStatic(string $method, array $parameters) - defined in Illuminate\Translation\Translator. Dynamically handle calls to the class.
  • public void __construct(Illuminate\Contracts\Translation\Loader $loader, string $locale) - defined in Illuminate\Translation\Translator. Create a new translator instance.
  • public void addJsonPath(string $path) - defined in Illuminate\Translation\Translator. Add a new JSON path to the loader.
  • public void addLines(array $lines, string $locale, string $namespace='*') - defined in Illuminate\Translation\Translator. Add translation lines to the given locale.
  • public void addNamespace(string $namespace, string $hint) - defined in Illuminate\Translation\Translator. Add a new namespace to the loader.
  • public string choice(string $key, Countable|int|array $number, array $replace=array(), string|null $locale=NULL) - defined in Illuminate\Translation\Translator. Get a translation according to an integer value.
  • public string getFallback() - defined in Illuminate\Translation\Translator. Get the fallback locale being used.
  • public Illuminate\Contracts\Translation\Loader getLoader() - defined in Illuminate\Translation\Translator. Get the language line loader implementation.
  • public string getLocale() - defined in Illuminate\Translation\Translator. Get the default locale being used.
  • public Illuminate\Translation\MessageSelector getSelector() - defined in Illuminate\Translation\Translator. Get the message selector instance.
  • public bool has(string $key, string|null $locale=NULL, bool $fallback=true) - defined in Illuminate\Translation\Translator. Determine if a translation exists.
  • public bool hasForLocale(string $key, string|null $locale=NULL) - defined in Illuminate\Translation\Translator. Determine if a translation exists for a given locale.
  • public static bool hasMacro(string $name) - defined in Illuminate\Translation\Translator. Checks if macro is registered.
  • public void load(string $namespace, string $group, string $locale) - defined in Illuminate\Translation\Translator. Load the specified language group.
  • public string locale() - defined in Illuminate\Translation\Translator. Get the default locale being used.
  • public static void macro(string $name, object|callable $macro) - defined in Illuminate\Translation\Translator. Register a custom macro.
  • public static void mixin(object $mixin, bool $replace=true) - defined in Illuminate\Translation\Translator. Mix another object into the class.
  • public array parseKey(string $key) - defined in Illuminate\Translation\Translator. Parse a key into namespace, group, and item.
  • public void setFallback(string $fallback) - defined in Illuminate\Translation\Translator. Set the fallback locale being used.
  • public void setLoaded(array $loaded) - defined in Illuminate\Translation\Translator. Set the loaded translation groups.
  • public void setLocale(string $locale) - defined in Illuminate\Translation\Translator. Set the default locale.
  • public void setParsedKey(string $key, array $parsed) - defined in Illuminate\Support\NamespacedItemResolver. Set the parsed value of a key.
  • public void setSelector(Illuminate\Translation\MessageSelector $selector) - defined in Illuminate\Translation\Translator. Set the message selector instance.

Protected methods

protected void getValidationSpecific($key, $replace, $locale)

getValidationSpecific checks the system namespace by default for "validation" keys

Parameters
  • $key
  • $replace
  • $locale

protected array localeArray(string|null $locale)

localeArray gets the array of locales to be checked

Parameters
  • string|null $locale

Show inherited protected methods

Inherited protected methods

  • protected string|array|null getLine(string $namespace, string $group, string $locale, string $item, array $replace) - defined in Illuminate\Translation\Translator. Retrieve a language line out the loaded array.
  • protected bool isLoaded(string $namespace, string $group, string $locale) - defined in Illuminate\Translation\Translator. Determine if the given group has been loaded.
  • protected string localeForChoice(string|null $locale) - defined in Illuminate\Translation\Translator. Get the proper locale for a choice operation.
  • protected string makeReplacements(string $line, array $replace) - defined in Illuminate\Translation\Translator. Make the place-holder replacements on a line.
  • protected array parseBasicSegments(array $segments) - defined in Illuminate\Support\NamespacedItemResolver. Parse an array of basic segments.
  • protected array parseNamespacedSegments(string $key) - defined in Illuminate\Support\NamespacedItemResolver. Parse an array of namespaced segments.
  • protected array sortReplacements(array $replace) - defined in Illuminate\Translation\Translator. Sort the replacements array.