* @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;
}
/**
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