Localisation updates from https://translatewiki.net.
[lhc/web/wiklou.git] / languages / Language.php
index 80aacb5..0a6ccd3 100644 (file)
@@ -942,14 +942,14 @@ class Language {
         * @param string $key
         * @return string
         */
-       function getMonthAbbreviation( $key ) {
+       public function getMonthAbbreviation( $key ) {
                return $this->getMessageFromDB( self::$mMonthAbbrevMsgs[$key - 1] );
        }
 
        /**
         * @return array
         */
-       function getMonthAbbreviationsArray() {
+       public function getMonthAbbreviationsArray() {
                $monthNames = [ '' ];
                for ( $i = 1; $i < 13; $i++ ) {
                        $monthNames[] = $this->getMonthAbbreviation( $i );
@@ -961,7 +961,7 @@ class Language {
         * @param string $key
         * @return string
         */
-       function getWeekdayName( $key ) {
+       public function getWeekdayName( $key ) {
                return $this->getMessageFromDB( self::$mWeekdayMsgs[$key - 1] );
        }
 
@@ -1089,7 +1089,7 @@ class Language {
         * @throws MWException
         * @return string
         */
-       function sprintfDate( $format, $ts, DateTimeZone $zone = null, &$ttl = null ) {
+       public function sprintfDate( $format, $ts, DateTimeZone $zone = null, &$ttl = null ) {
                $s = '';
                $raw = false;
                $roman = false;
@@ -1555,7 +1555,7 @@ class Language {
         *
         * @param string $ts
         *
-        * @return string
+        * @return int[]
         */
        private static function tsToIranian( $ts ) {
                $gy = substr( $ts, 0, 4 ) -1600;
@@ -1613,7 +1613,7 @@ class Language {
         *
         * @param string $ts
         *
-        * @return string
+        * @return int[]
         */
        private static function tsToHijri( $ts ) {
                $year = substr( $ts, 0, 4 );
@@ -1665,7 +1665,7 @@ class Language {
         *
         * @param string $ts
         *
-        * @return string
+        * @return int[]
         */
        private static function tsToHebrew( $ts ) {
                # Parse date
@@ -2067,7 +2067,7 @@ class Language {
         *   get user timecorrection setting)
         * @return int
         */
-       function userAdjust( $ts, $tz = false ) {
+       public function userAdjust( $ts, $tz = false ) {
                global $wgUser, $wgLocalTZoffset;
 
                if ( $tz === false ) {
@@ -2214,7 +2214,7 @@ class Language {
         *   validateTimeZone() in Special:Preferences
         * @return string
         */
-       function date( $ts, $adj = false, $format = true, $timecorrection = false ) {
+       public function date( $ts, $adj = false, $format = true, $timecorrection = false ) {
                $ts = wfTimestamp( TS_MW, $ts );
                if ( $adj ) {
                        $ts = $this->userAdjust( $ts, $timecorrection );
@@ -2233,7 +2233,7 @@ class Language {
         *   validateTimeZone() in Special:Preferences
         * @return string
         */
-       function time( $ts, $adj = false, $format = true, $timecorrection = false ) {
+       public function time( $ts, $adj = false, $format = true, $timecorrection = false ) {
                $ts = wfTimestamp( TS_MW, $ts );
                if ( $adj ) {
                        $ts = $this->userAdjust( $ts, $timecorrection );
@@ -2253,7 +2253,7 @@ class Language {
         *   validateTimeZone() in Special:Preferences
         * @return string
         */
-       function timeanddate( $ts, $adj = false, $format = true, $timecorrection = false ) {
+       public function timeanddate( $ts, $adj = false, $format = true, $timecorrection = false ) {
                $ts = wfTimestamp( TS_MW, $ts );
                if ( $adj ) {
                        $ts = $this->userAdjust( $ts, $timecorrection );
@@ -2559,7 +2559,7 @@ class Language {
         * @param string $key
         * @return array|null
         */
-       function getMessage( $key ) {
+       public function getMessage( $key ) {
                return self::$dataCache->getSubitem( $this->mCode, 'messages', $key );
        }
 
@@ -2576,7 +2576,7 @@ class Language {
         * @param string $string
         * @return string
         */
-       function iconv( $in, $out, $string ) {
+       public function iconv( $in, $out, $string ) {
                # This is a wrapper for iconv in all languages except esperanto,
                # which does some nasty x-conversions beforehand
 
@@ -2623,7 +2623,7 @@ class Language {
         *
         * @return string
         */
-       function ucfirst( $str ) {
+       public function ucfirst( $str ) {
                $o = ord( $str );
                if ( $o < 96 ) { // if already uppercase...
                        return $str;
@@ -2643,7 +2643,7 @@ class Language {
         *
         * @return string
         */
-       function uc( $str, $first = false ) {
+       public function uc( $str, $first = false ) {
                if ( $first ) {
                        if ( $this->isMultibyte( $str ) ) {
                                return mb_strtoupper( mb_substr( $str, 0, 1 ) ) . mb_substr( $str, 1 );
@@ -3895,10 +3895,11 @@ class Language {
         * match up with it.
         *
         * @param string $str The validated block duration in English
+        * @param User $user User object to use timezone from or null for $wgUser
         * @return string Somehow translated block duration
         * @see LanguageFi.php for example implementation
         */
-       function translateBlockExpiry( $str ) {
+       function translateBlockExpiry( $str, User $user = null ) {
                $duration = SpecialBlock::getSuggestedDurations( $this );
                foreach ( $duration as $show => $value ) {
                        if ( strcmp( $str, $value ) == 0 ) {
@@ -3924,10 +3925,12 @@ class Language {
                } else { // It's an absolute timestamp.
                        if ( $time === 0 ) {
                                // wfTimestamp() handles 0 as current time instead of epoch.
-                               return $this->timeanddate( '19700101000000' );
-                       } else {
-                               return $this->timeanddate( $time );
+                               $time = '19700101000000';
+                       }
+                       if ( $user ) {
+                               return $this->userTimeAndDate( $time, $user );
                        }
+                       return $this->timeanddate( $time );
                }
        }
 
@@ -4187,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
         *