Translator
Winter translator class.
class Winter\Storm\Translation\Translator
extends Illuminate\Translation\Translator
Extends
Class | Description |
---|---|
Illuminate\Translation\Translator
|
Constants
Constant | Type | Value | Description |
---|---|---|---|
CORE_LOCALE
|
string |
"en"
|
string
"en"
|
Properties
protected
$aliases
:
array
= []
List of namespace aliases. ['aliased.namespace' => 'real.namespace']
protected $events : Illuminate\Contracts\Events\Dispatcher | Winter\Storm\Events\Dispatcher | null
The event dispatcher instance.
Methods
public
get (string $key, array $replace = []
, string | null $locale = null
, boolean $fallback = true
)
: string | array | null
Get the translation for the given key.
Parameters
Property | Type | Description |
---|---|---|
$key | string |
string
|
$replace | array |
array
|
$locale | string | null |
string | null
|
$fallback | boolean |
boolean
|
Returns
string | array | null
public parseKey (string $key) : array
Parse a key into namespace, group, and item.
Parameters
Property | Type | Description |
---|---|---|
$key | string |
string
|
Returns
array
public registerNamespaceAlias (string $namespace, string $alias) : void
Register a namespace alias.
Parameters
Property | Type | Description |
---|---|---|
$namespace | string |
string
The namespace to register an alias for. Example: winter.blog |
$alias | string |
string
The alias to register. Example: rainlab.blog |
Returns
void
public
set (array | string $key, $value = null
, $locale = null
)
: void
Set the language string value for a given key in a given locale.
If no locale is provided, the language string will be set for the default locale.
Parameters
Property | Type | Description |
---|---|---|
$key | array | string |
array | string
|
$value | mixed |
mixed
|
$locale | mixed |
mixed
|
Returns
void
public setEventDispatcher (Illuminate\Contracts\Events\Dispatcher $events) : void
Set the event dispatcher instance.
Parameters
Property | Type | Description |
---|---|---|
$events | Illuminate\Contracts\Events\Dispatcher |
Illuminate\Contracts\Events\Dispatcher
|
Returns
void
public
trans (string $key, array $replace = []
, string $locale = null
)
: string | array | null
Get the translation for a given key.
Parameters
Property | Type | Description |
---|---|---|
$key | string |
string
|
$replace | array |
array
|
$locale | string |
string
|
Returns
string | array | null
public
transChoice (string $key, int | array | Countable $number, array $replace = []
, string $locale = null
)
: string
Get a translation according to an integer value.
Parameters
Property | Type | Description |
---|---|---|
$key | string |
string
|
$number | int | array | Countable |
int | array | Countable
|
$replace | array |
array
|
$locale | string |
string
|
Returns
string
protected getValidationSpecific (string $key, array $replace, string $locale) : string | null
Check the system namespace by default for "validation" keys.
Parameters
Property | Type | Description |
---|---|---|
$key | string |
string
|
$replace | array |
array
|
$locale | string |
string
|
Returns
string | null
protected localeArray (string | null $locale) : array
Get the array of locales to be checked.
Parameters
Property | Type | Description |
---|---|---|
$locale | string | null |
string | null
|
Returns
array
protected localeForChoice ($locale)
Parameters
Property | Type | Description |
---|---|---|
$locale | mixed |
mixed
|
Returns
mixed
← Previous page
Winter\Storm\Translation\TranslationServiceProvider
Next page →
Winter\Storm\Validation\Concerns\FormatsMessages
Copyright © 2024 Winter CMS