Fix to language handling
authorNiklas Laxström <nikerabbit@users.mediawiki.org>
Mon, 20 Sep 2010 13:24:31 +0000 (13:24 +0000)
committerNiklas Laxström <nikerabbit@users.mediawiki.org>
Mon, 20 Sep 2010 13:24:31 +0000 (13:24 +0000)
includes/Message.php

index f2ff88b..44c72ad 100644 (file)
@@ -101,8 +101,10 @@ class Message {
         * @return Message: $this
         */
        public function __construct( $key, $params = array() ) {
+               global $wgLang;
                $this->key = $key;
                $this->parameters = array_values( $params );
+               $this->language = $wgLang;
        }
 
        /**
@@ -172,8 +174,9 @@ class Message {
         * @return Message: $this
         */
        public function inContentLanguage() {
+               global $wgContLang;
                $this->interface = false;
-               $this->language = null;
+               $this->language = $wgContLang;
                return $this;
        }
 
@@ -264,7 +267,7 @@ class Message {
 
        /**
         * Returns the message text. {{-transformation is done and the result
-        * is excaped excluding any raw parameters.
+        * is escaped excluding any raw parameters.
         * @return String: Escaped message text.
         */
        public function escaped() {
@@ -309,8 +312,8 @@ class Message {
         * @return Wikitext parsed into HTML
         */
        protected function parseText( $string ) {
-               global $wgOut;
-               if ( $this->language !== null ) {
+               global $wgOut, $wgLang, $wgContLang;
+               if ( $this->language !== $wgLang && $this->language !== $wgContLang ) {
                        # FIXME: remove this limitation
                        throw new MWException( 'Can only parse in interface or content language' );
                }