X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=languages%2FLanguage.php;h=3a12439e6e97b745122a34f869f0dee7df6944f7;hp=1b5580cada83a8b04a4bdc59b057a76c99077bd2;hb=b2a1a180087768674d70472cacf9349f85d21c1c;hpb=27a6845c2a675990b04dfead674c0d46d140aa17 diff --git a/languages/Language.php b/languages/Language.php index 1b5580cada..3a12439e6e 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -27,6 +27,7 @@ */ use CLDRPluralRuleParser\Evaluator; +use MediaWiki\MediaWikiServices; use Wikimedia\Assert\Assert; /** @@ -506,7 +507,8 @@ class Language { if ( is_null( $this->namespaceNames ) ) { global $wgMetaNamespace, $wgMetaNamespaceTalk, $wgExtraNamespaces; - $validNamespaces = MWNamespace::getCanonicalNamespaces(); + $validNamespaces = MediaWikiServices::getInstance()->getNamespaceInfo()-> + getCanonicalNamespaces(); $this->namespaceNames = $wgExtraNamespaces + self::$dataCache->getItem( $this->mCode, 'namespaceNames' ); @@ -744,7 +746,8 @@ class Language { */ public function getNsIndex( $text ) { $lctext = $this->lc( $text ); - $ns = MWNamespace::getCanonicalIndex( $lctext ); + $ns = MediaWikiServices::getInstance()->getNamespaceInfo()-> + getCanonicalIndex( $lctext ); if ( $ns !== null ) { return $ns; } @@ -1977,7 +1980,11 @@ class Language { $gy_offset = '元'; } $gy_offset = '昭和' . $gy_offset; - } else { + } elseif ( + ( ( $gy == 1989 ) && ( $gm == 1 ) && ( $gd >= 8 ) ) || + ( ( $gy > 1989 ) && ( $gy < 2019 ) ) || + ( ( $gy == 2019 ) && ( $gm < 5 ) ) + ) { # Heisei period $gy_gannen = $gy - 1989 + 1; $gy_offset = $gy_gannen; @@ -1985,6 +1992,14 @@ class Language { $gy_offset = '元'; } $gy_offset = '平成' . $gy_offset; + } else { + # Reiwa period + $gy_gannen = $gy - 2019 + 1; + $gy_offset = $gy_gannen; + if ( $gy_gannen == 1 ) { + $gy_offset = '元'; + } + $gy_offset = '令和' . $gy_offset; } } else { $gy_offset = $gy; @@ -3018,34 +3033,6 @@ class Language { } } - /** - * @deprecated No-op since 1.28 - */ - function initEncoding() { - wfDeprecated( __METHOD__, '1.28' ); - // No-op. - } - - /** - * @param string $s - * @return string - * @deprecated No-op since 1.28 - */ - function recodeForEdit( $s ) { - wfDeprecated( __METHOD__, '1.28' ); - return $s; - } - - /** - * @param string $s - * @return string - * @deprecated No-op since 1.28 - */ - function recodeInput( $s ) { - wfDeprecated( __METHOD__, '1.28' ); - return $s; - } - /** * Convert a UTF-8 string to normal form C. In Malayalam and Arabic, this * also cleans up certain backwards-compatible sequences, converting them