-
Notifications
You must be signed in to change notification settings - Fork 0
Api: HasMessages
Adrian edited this page Feb 28, 2024
·
3 revisions
An interface for objects that use/provide ICU messages.
-
Builds a message from the given key and context, if a matching format is found.
public makeMessage( string $key, array $context = [], string $locale = null ) : string
-
parameters:
- string
$key
: Message identifier. This is a dot-delimited path for the message format to look up. - array
$context
: Formatting context, in key:value format. Non-scalar values will be encoded if possible. - string
$locale
: The locale to use for formatting. If omitted, uses the MessagyRegistry's default local.
- string
-
Throws
MessageException
MessageError::NoMessages: If no matching message is found for the given key. -
Throws
MessageException
MessageError::NotAMessage: If the given key is found but is not a formatting string. -
Returns
string
: A formatted message on success.
-
parameters: