Add parameters to LanguageQqx-generated messages.
authorNiklas Laxström <niklas.laxstrom@gmail.com>
Mon, 8 Oct 2012 20:51:46 +0000 (20:51 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 8 Oct 2012 20:54:25 +0000 (20:54 +0000)
This avoids outputing bunch of unhelpful (parentheses) messages.

Change-Id: I55fab4f132f28be3fe7e4bc8f51d403b11d24284

includes/Message.php
languages/classes/LanguageQqx.php

index 9d09f00..87b53aa 100644 (file)
@@ -420,6 +420,15 @@ class Message {
                        return '&lt;' . $key . '&gt;';
                }
 
+               # Replace $* with a list of parameters for &uselang=qqx.
+               if ( strpos( $string, '$*' ) !== false ) {
+                       $paramlist = '';
+                       if ( $this->parameters !== array() ) {
+                               $paramlist = ': $' . implode( ', $', range( 1, count( $this->parameters ) ) );
+                       }
+                       $string = str_replace( '$*', $paramlist, $string );
+               }
+
                # Replace parameters before text parsing
                $string = $this->replaceParameters( $string, 'before' );
 
index 8e2115c..9d92834 100644 (file)
@@ -36,6 +36,6 @@ class LanguageQqx extends Language {
         * @return string
         */
        function getMessage( $key ) {
-               return "($key)";
+               return "($key$*)";
        }
 }