Message Interface Reference
Detailed Description
Message is used to get localized messages to be used in the user interface.
- Note
- The language of a message is determined in one of 3 ways (in this order):
- use the value of the lang parameter passed to Message::getText()
- use the value of language from the Message configuration section
- use the value of the global variable $_SERVER['HTTP_ACCEPT_LANGUAGE']
Definition at line 23 of file Message.php.
Inheritance diagram for Message:
Public Member Functions | |
getText ($message, $parameters=null, $lang='') | |
getAll ($lang='') | |
Member Function Documentation
◆ getText()
getText | ( | $message, | |
$parameters = null , |
|||
$lang = '' |
|||
) |
Get a localized string.
- Note
- It is not recommended to use this method with concatenated strings because this restricts the positions of words in translations. E.g. 'She was born in %0% on %1' translates to the german sentence 'Sie wurde am %1% in %0% geboren' with the variables flipped.
- Implementations must return the original message, if no translation is found, or the translation string is empty.
- Parameters
-
$message The message to translate (%0%, %1%, ... will be replaced by given parameters). $parameters An array of values for parameter substitution in the message. $lang The language (optional, default: '')
- Returns
- The localized string
Implemented in FileMessage.
◆ getAll()
getAll | ( | $lang = '' | ) |
Get a list of all localized strings.
- Parameters
-
$lang The language (optional, default: '')
- Returns
- An array of localized strings
Implemented in FileMessage.