Message.php
1 <?php
2 /**
3  * wCMF - wemove Content Management Framework
4  * Copyright (C) 2005-2017 wemove digital solutions GmbH
5  *
6  * Licensed under the terms of the MIT License.
7  *
8  * See the LICENSE file distributed with this work for
9  * additional information.
10  */
11 namespace wcmf\lib\i18n;
12 
13 /**
14  * Message is used to get localized messages to be used in the user interface.
15 
16  * @note The language of a message is determined in one of 3 ways (in this order):
17  * -# use the value of the lang parameter passed to Message::getText()
18  * -# use the value of language from the Message configuration section
19  * -# use the value of the global variable $_SERVER['HTTP_ACCEPT_LANGUAGE']
20  *
21  * @author ingo herwig <ingo@wemove.com>
22  */
23 interface Message {
24 
25  /**
26  * Get a localized string.
27  * @note It is not recommended to use this method with concatenated strings because this
28  * restricts the positions of words in translations. E.g. 'She was born in %0% on %1%'
29  * translates to the german sentence 'Sie wurde am %1% in %0% geboren' with the variables
30  * flipped.
31  * @note Implementations must return the original message, if no translation is found,
32  * or the translation string is empty.
33  * @param $message The message to translate (%0%, %1%, ... will be replaced by given parameters).
34  * @param $parameters An array of values for parameter substitution in the message.
35  * @param $lang The language (optional, default: '')
36  * @return The localized string
37  */
38  public function getText($message, $parameters=null, $lang='');
39 
40  /**
41  * Get a list of all localized strings.
42  * @param $lang The language (optional, default: '')
43  * @return An array of localized strings
44  */
45  public function getAll($lang='');
46 }
47 ?>
Message is used to get localized messages to be used in the user interface.
Definition: Message.php:23
I18N related interfaces and classes.
Definition: namespaces.php:16
getText($message, $parameters=null, $lang='')
Get a localized string.
getAll($lang='')
Get a list of all localized strings.