Merge "skins: Minor code clean up"
[lhc/web/wiklou.git] / languages / Language.php
index e7643b1..37f4137 100644 (file)
@@ -30,8 +30,6 @@ if ( !defined( 'MEDIAWIKI' ) ) {
        exit( 1 );
 }
 
-mb_internal_encoding( 'UTF-8' );
-
 use CLDRPluralRuleParser\Evaluator;
 
 /**
@@ -1089,7 +1087,7 @@ class Language {
         * @throws MWException
         * @return string
         */
-       public function sprintfDate( $format, $ts, DateTimeZone $zone = null, &$ttl = null ) {
+       public function sprintfDate( $format, $ts, DateTimeZone $zone = null, &$ttl = 'unused' ) {
                $s = '';
                $raw = false;
                $roman = false;
@@ -1454,7 +1452,9 @@ class Language {
                        }
                }
 
-               if ( $usedSecond ) {
+               if ( $ttl === 'unused' ) {
+                       // No need to calculate the TTL, the caller wont use it anyway.
+               } elseif ( $usedSecond ) {
                        $ttl = 1;
                } elseif ( $usedMinute ) {
                        $ttl = 60 - substr( $ts, 12, 2 );
@@ -4190,6 +4190,17 @@ class Language {
                return $lang;
        }
 
+       /**
+        * Compare with an other language object
+        *
+        * @since 1.28
+        * @param Language $lang
+        * @return boolean
+        */
+       public function equals( Language $lang ) {
+               return $lang->getCode() === $this->mCode;
+       }
+
        /**
         * Get the internal language code for this language object
         *