Merge "Make FakeConverter more realistic"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 29 Aug 2013 15:11:22 +0000 (15:11 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 29 Aug 2013 15:11:22 +0000 (15:11 +0000)
1  2 
languages/Language.php

diff --combined languages/Language.php
@@@ -49,12 -49,14 +49,14 @@@ class FakeConverter 
         */
        public $mLang;
        function __construct( $langobj ) { $this->mLang = $langobj; }
+       function autoConvert( $text, $variant = false ) { return $text; }
        function autoConvertToAllVariants( $text ) { return array( $this->mLang->getCode() => $text ); }
        function convert( $t ) { return $t; }
        function convertTo( $text, $variant ) { return $text; }
        function convertTitle( $t ) { return $t->getPrefixedText(); }
        function convertNamespace( $ns ) { return $this->mLang->getFormattedNsText( $ns ); }
        function getVariants() { return array( $this->mLang->getCode() ); }
+       function getVariantFallbacks( $variant ) { return $this->mLang->getCode(); }
        function getPreferredVariant() { return $this->mLang->getCode(); }
        function getDefaultVariant() { return $this->mLang->getCode(); }
        function getURLVariant() { return ''; }
@@@ -66,6 -68,8 +68,8 @@@
        function convertCategoryKey( $key ) { return $key; }
        function convertLinkToAllVariants( $text ) { return $this->autoConvertToAllVariants( $text ); }
        function armourMath( $text ) { return $text; }
+       function validateVariant( $variant = null ) { return $variant === $this->mLang->getCode() ? $variant : null; }
+       function translate( $text, $variant ) { return $text; }
  }
  
  /**
@@@ -2089,9 -2093,6 +2093,9 @@@ class Language 
                $segments = array();
  
                foreach ( $intervals as $intervalName => $intervalValue ) {
 +                      // Give grep a chance to find the usages:
 +                      // duration-centuries, duration-decades, duration-years, duration-days,
 +                      // duration-hours, duration-minutes, duration-seconds
                        $message = wfMessage( 'duration-' . $intervalName )->numParams( $intervalValue );
                        $segments[] = $message->inLanguage( $this )->escaped();
                }