*/
use CLDRPluralRuleParser\Evaluator;
+use MediaWiki\MediaWikiServices;
use Wikimedia\Assert\Assert;
/**
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' );
*/
public function getNsIndex( $text ) {
$lctext = $this->lc( $text );
- $ns = MWNamespace::getCanonicalIndex( $lctext );
+ $ns = MediaWikiServices::getInstance()->getNamespaceInfo()->
+ getCanonicalIndex( $lctext );
if ( $ns !== null ) {
return $ns;
}
$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;
$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;