Merge "Remove redirectToFragment() from wikibits.js"
[lhc/web/wiklou.git] / includes / Message.php
index 7c9b095..d0ce482 100644 (file)
@@ -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