X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FMessage.php;h=31fbb07733dce592f5b0843328140e7b5dbfa2df;hb=5fea642f16cefb08d32d69013b2bc845670f2486;hp=7c9b095a292c11d200d25e8f9378d2d51b9dd22c;hpb=327c8f47bcf89b04ee04ebdf78e72f0254f5b5bf;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Message.php b/includes/Message.php index 7c9b095a29..31fbb07733 100644 --- a/includes/Message.php +++ b/includes/Message.php @@ -223,12 +223,14 @@ class Message { * @param string|string[] $key Message key or array of message keys to try and use the first * non-empty message for. * @param array $params Message parameters. + * @param Language $language Optional language of the message, defaults to $wgLang. */ - public function __construct( $key, $params = array() ) { + public function __construct( $key, $params = array(), Language $language = null ) { global $wgLang; + $this->key = $key; $this->parameters = array_values( $params ); - $this->language = $wgLang; + $this->language = $language ? $language : $wgLang; } /** @@ -270,6 +272,17 @@ class Message { return $this->format; } + /** + * Returns the Language of the Message. + * + * @since 1.23 + * + * @return Language + */ + public function getLanguage() { + return $this->language; + } + /** * Factory function that is just wrapper for the real constructor. It is * intended to be used instead of the real constructor, because it allows @@ -430,7 +443,7 @@ class Message { * * @since 1.22 * - * @param number|number[] [$param,...] Time period parameters, or a single argument that is + * @param int|int[] [$param,...] Time period parameters, or a single argument that is * an array of time period parameters. * * @return Message $this @@ -495,7 +508,7 @@ class Message { * * @since 1.19 * - * @param $context IContextSource + * @param IContextSource $context * * @return Message $this */ @@ -532,6 +545,7 @@ class Message { . "passed a String or Language object; $type given" ); } + $this->message = null; $this->interface = false; return $this; } @@ -552,8 +566,7 @@ class Message { } global $wgContLang; - $this->interface = false; - $this->language = $wgContLang; + $this->inLanguage( $wgContLang ); return $this; } @@ -591,7 +604,7 @@ class Message { * * @since 1.18 * - * @param $title Title object + * @param Title $title * * @return Message $this */ @@ -877,7 +890,7 @@ class Message { * @param string $message The message text. * @param string $type Either "before" or "after". * - * @return String + * @return string */ protected function replaceParameters( $message, $type = 'before' ) { $replacementKeys = array();