Package
in package
Message Catalog
Table of Contents
Properties
- $fallback : string|null
- The name of a fallback package to use when a message key does not exist.
- $formatter : string
- The name of the formatter to use when formatting translated messages.
- $messages : array<string|int, array<string|int, mixed>|string>
- Message keys and translations in this package.
Methods
- __construct() : mixed
- Constructor.
- addMessage() : void
- Adds one message for this package.
- addMessages() : void
- Adds new messages for this package.
- getFallback() : string|null
- Gets the fallback package name.
- getFormatter() : string
- Gets the formatter name for this package.
- getMessage() : array<string|int, mixed>|string|false
- Gets the message of the given key for this package.
- getMessages() : array<string|int, array<string|int, mixed>|string>
- Gets the messages for this package.
- setFallback() : void
- Sets the fallback package name.
- setFormatter() : void
- Sets the formatter name for this package.
- setMessages() : void
- Sets the messages for this package.
Properties
$fallback
The name of a fallback package to use when a message key does not exist.
protected
string|null
$fallback
$formatter
The name of the formatter to use when formatting translated messages.
protected
string
$formatter
$messages
Message keys and translations in this package.
protected
array<string|int, array<string|int, mixed>|string>
$messages
= []
Methods
__construct()
Constructor.
public
__construct([string $formatter = 'default' ][, string|null $fallback = null ][, array<string|int, array<string|int, mixed>|string> $messages = [] ]) : mixed
Parameters
- $formatter : string = 'default'
-
The name of the formatter to use.
- $fallback : string|null = null
-
The name of the fallback package to use.
- $messages : array<string|int, array<string|int, mixed>|string> = []
-
The messages in this package.
addMessage()
Adds one message for this package.
public
addMessage(string $key, array<string|int, mixed>|string $message) : void
Parameters
- $key : string
-
the key of the message
- $message : array<string|int, mixed>|string
-
the actual message
addMessages()
Adds new messages for this package.
public
addMessages(array<string|int, array<string|int, mixed>|string> $messages) : void
Parameters
- $messages : array<string|int, array<string|int, mixed>|string>
-
The messages to add in this package.
getFallback()
Gets the fallback package name.
public
getFallback() : string|null
Return values
string|nullgetFormatter()
Gets the formatter name for this package.
public
getFormatter() : string
Return values
stringgetMessage()
Gets the message of the given key for this package.
public
getMessage(string $key) : array<string|int, mixed>|string|false
Parameters
- $key : string
-
the key of the message to return
Return values
array<string|int, mixed>|string|false —The message translation, or false if not found.
getMessages()
Gets the messages for this package.
public
getMessages() : array<string|int, array<string|int, mixed>|string>
Return values
array<string|int, array<string|int, mixed>|string>setFallback()
Sets the fallback package name.
public
setFallback(string|null $fallback) : void
Parameters
- $fallback : string|null
-
The fallback package name.
setFormatter()
Sets the formatter name for this package.
public
setFormatter(string $formatter) : void
Parameters
- $formatter : string
-
The formatter name for this package.
setMessages()
Sets the messages for this package.
public
setMessages(array<string|int, array<string|int, mixed>|string> $messages) : void
Parameters
- $messages : array<string|int, array<string|int, mixed>|string>
-
The messages for this package.