October\Rain\Translation\Translator

Overview

Translator class

Extends
  • Illuminate\Translation\Translator
  • Illuminate\Support\NamespacedItemResolver
Implements
  • Illuminate\Contracts\Translation\Translator

Protected Properties

There are no protected properties in the class.

Show inherited protected properties

Inherited Protected Properties

  • $loader - The loader implementation. (defined in Illuminate\Translation\Translator)
  • $locale - The default locale being used by the translator. (defined in Illuminate\Translation\Translator)
  • $fallback - The fallback locale used by the translator. (defined in Illuminate\Translation\Translator)
  • $loaded - The array of loaded translation groups. (defined in Illuminate\Translation\Translator)
  • $selector - The message selector. (defined in Illuminate\Translation\Translator)
  • $determineLocalesUsing - The callable that should be invoked to determine applicable locales. (defined in Illuminate\Translation\Translator)
  • $stringableHandlers - The custom rendering callbacks for stringable objects. (defined in Illuminate\Translation\Translator)
  • $parsed - A cache of the parsed items. (defined in Illuminate\Support\NamespacedItemResolver)
  • $macros - The registered string macros. (defined in Illuminate\Translation\Translator)

Public Methods

public get()

public get($key, $replace = [], $locale = null, $fallback = true): void

get the translation for the given key. This logic carbon copies the Laravel parent class with an additional check to proxy 'validation' messages to 'system::validation', and adds fallback support to JSON messages.

public set()

public set(
    array|string $key,
    mixed $value = null,
    string|null $locale = null
): void 

set a given language key value.

public trans()

public trans(
    array|string $id,
    array $parameters = [],
    string $locale = null
): string 

trans returns the translation for a given key

public transChoice()

public transChoice(
    string $id,
    int $number,
    array $parameters = [],
    string $locale = null
): string 

transChoice gets a translation according to an integer value

Show inherited public methods

Inherited Public Methods

  • __call() - Dynamically handle calls to the class. (defined in Illuminate\Translation\Translator)
  • __callStatic() - Dynamically handle calls to the class. (defined in Illuminate\Translation\Translator)
  • __construct() - Create a new translator instance. (defined in Illuminate\Translation\Translator)
  • addJsonPath() - Add a new JSON path to the loader. (defined in Illuminate\Translation\Translator)
  • addLines() - Add translation lines to the given locale. (defined in Illuminate\Translation\Translator)
  • addNamespace() - Add a new namespace to the loader. (defined in Illuminate\Translation\Translator)
  • choice() - Get a translation according to an integer value. (defined in Illuminate\Translation\Translator)
  • determineLocalesUsing() - Specify a callback that should be invoked to determined the applicable locale array. (defined in Illuminate\Translation\Translator)
  • flushMacros() - Flush the existing macros. (defined in Illuminate\Translation\Translator)
  • flushParsedKeys() - Flush the cache of parsed keys. (defined in Illuminate\Support\NamespacedItemResolver)
  • getFallback() - Get the fallback locale being used. (defined in Illuminate\Translation\Translator)
  • getLoader() - Get the language line loader implementation. (defined in Illuminate\Translation\Translator)
  • getLocale() - Get the default locale being used. (defined in Illuminate\Translation\Translator)
  • getSelector() - Get the message selector instance. (defined in Illuminate\Translation\Translator)
  • has() - Determine if a translation exists. (defined in Illuminate\Translation\Translator)
  • hasForLocale() - Determine if a translation exists for a given locale. (defined in Illuminate\Translation\Translator)
  • hasMacro() - Checks if macro is registered. (defined in Illuminate\Translation\Translator)
  • load() - Load the specified language group. (defined in Illuminate\Translation\Translator)
  • locale() - Get the default locale being used. (defined in Illuminate\Translation\Translator)
  • macro() - Register a custom macro. (defined in Illuminate\Translation\Translator)
  • mixin() - Mix another object into the class. (defined in Illuminate\Translation\Translator)
  • parseKey() - Parse a key into namespace, group, and item. (defined in Illuminate\Translation\Translator)
  • setFallback() - Set the fallback locale being used. (defined in Illuminate\Translation\Translator)
  • setLoaded() - Set the loaded translation groups. (defined in Illuminate\Translation\Translator)
  • setLocale() - Set the default locale. (defined in Illuminate\Translation\Translator)
  • setParsedKey() - Set the parsed value of a key. (defined in Illuminate\Support\NamespacedItemResolver)
  • setSelector() - Set the message selector instance. (defined in Illuminate\Translation\Translator)
  • stringable() - Add a handler to be executed in order to format a given class to a string during translation replacements. (defined in Illuminate\Translation\Translator)

Protected Methods

protected getValidationSpecific()

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

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

protected localeArray()

protected localeArray(string|null $locale): array 

localeArray gets the array of locales to be checked

Show inherited protected methods

Inherited Protected Methods

  • closureParameterTypes() - Get the class names / types of the parameters of the given Closure. (defined in Illuminate\Translation\Translator)
  • firstClosureParameterType() - Get the class name of the first parameter of the given Closure. (defined in Illuminate\Translation\Translator)
  • firstClosureParameterTypes() - Get the class names of the first parameter of the given Closure, including union types. (defined in Illuminate\Translation\Translator)
  • getLine() - Retrieve a language line out the loaded array. (defined in Illuminate\Translation\Translator)
  • isLoaded() - Determine if the given group has been loaded. (defined in Illuminate\Translation\Translator)
  • localeForChoice() - Get the proper locale for a choice operation. (defined in Illuminate\Translation\Translator)
  • makeReplacements() - Make the place-holder replacements on a line. (defined in Illuminate\Translation\Translator)
  • parseBasicSegments() - Parse an array of basic segments. (defined in Illuminate\Support\NamespacedItemResolver)
  • parseNamespacedSegments() - Parse an array of namespaced segments. (defined in Illuminate\Support\NamespacedItemResolver)