* @return array
* @since 1.19
*/
- function getFallbackLanguages() {
+ public function getFallbackLanguages() {
return self::getFallbacksFor( $this->mCode );
}
* Exports $wgBookstoreListEn
* @return array
*/
- function getBookstoreList() {
+ public function getBookstoreList() {
return self::$dataCache->getItem( $this->mCode, 'bookstoreList' );
}
*
* @return array
*/
- function getFormattedNamespaces() {
+ public function getFormattedNamespaces() {
$ns = $this->getNamespaces();
foreach ( $ns as $k => $v ) {
$ns[$k] = strtr( $v, '_', ' ' );
* @param int $index The array key of the namespace to return
* @return string|bool String if the namespace value exists, otherwise false
*/
- function getNsText( $index ) {
+ public function getNsText( $index ) {
$ns = $this->getNamespaces();
return isset( $ns[$index] ) ? $ns[$index] : false;
}
* @param int $index The array key of the namespace to return
* @return string Namespace name without underscores (empty string if namespace does not exist)
*/
- function getFormattedNsText( $index ) {
+ public function getFormattedNsText( $index ) {
$ns = $this->getNsText( $index );
return strtr( $ns, '_', ' ' );
}
* @return string
* @since 1.18
*/
- function getGenderNsText( $index, $gender ) {
+ public function getGenderNsText( $index, $gender ) {
global $wgExtraGenderNamespaces;
$ns = $wgExtraGenderNamespaces +
* @return bool
* @since 1.18
*/
- function needsGenderDistinction() {
+ public function needsGenderDistinction() {
global $wgExtraGenderNamespaces, $wgExtraNamespaces;
if ( count( $wgExtraGenderNamespaces ) > 0 ) {
// $wgExtraGenderNamespaces overrides everything
/**
* @return array
*/
- function getNamespaceAliases() {
+ public function getNamespaceAliases() {
if ( is_null( $this->namespaceAliases ) ) {
$aliases = self::$dataCache->getItem( $this->mCode, 'namespaceAliases' );
if ( !$aliases ) {
/**
* @return array
*/
- function getNamespaceIds() {
+ public function getNamespaceIds() {
if ( is_null( $this->mNamespaceIds ) ) {
global $wgNamespaceAliases;
# Put namespace names and aliases into a hashtable.
* @param string $text
* @return int|bool An integer if $text is a valid value otherwise false
*/
- function getNsIndex( $text ) {
+ public function getNsIndex( $text ) {
$lctext = $this->lc( $text );
$ns = MWNamespace::getCanonicalIndex( $lctext );
if ( $ns !== null ) {
* @param bool $usemsg Use the "variantname-xyz" message if it exists
* @return string
*/
- function getVariantname( $code, $usemsg = true ) {
+ public function getVariantname( $code, $usemsg = true ) {
$msg = "variantname-$code";
if ( $usemsg && wfMessage( $msg )->exists() ) {
return $this->getMessageFromDB( $msg );
/**
* @return array
*/
- function getDatePreferences() {
+ public function getDatePreferences() {
return self::$dataCache->getItem( $this->mCode, 'datePreferences' );
}
/**
* @return array|string
*/
- function getDefaultDateFormat() {
+ public function getDefaultDateFormat() {
$df = self::$dataCache->getItem( $this->mCode, 'defaultDateFormat' );
if ( $df === 'dmy or mdy' ) {
global $wgAmericanDates;
/**
* @return array
*/
- function getDatePreferenceMigrationMap() {
+ public function getDatePreferenceMigrationMap() {
return self::$dataCache->getItem( $this->mCode, 'datePreferenceMigrationMap' );
}
* @return array
* @since 1.24
*/
- function getImageFiles() {
+ public function getImageFiles() {
return self::$dataCache->getItem( $this->mCode, 'imageFiles' );
}
/**
* @return array
*/
- function getExtraUserToggles() {
+ public function getExtraUserToggles() {
return (array)self::$dataCache->getItem( $this->mCode, 'extraUserToggles' );
}
* @param string $msg Message name
* @return string
*/
- function getMessageFromDB( $msg ) {
+ public function getMessageFromDB( $msg ) {
return $this->msg( $msg )->text();
}
* @param string $key
* @return string
*/
- function getMonthName( $key ) {
+ public function getMonthName( $key ) {
return $this->getMessageFromDB( self::$mMonthMsgs[$key - 1] );
}
/**
* @return array
*/
- function getMonthNamesArray() {
+ public function getMonthNamesArray() {
$monthNames = [ '' ];
for ( $i = 1; $i < 13; $i++ ) {
$monthNames[] = $this->getMonthName( $i );
* @param string $key
* @return string
*/
- function getMonthNameGen( $key ) {
+ public function getMonthNameGen( $key ) {
return $this->getMessageFromDB( self::$mMonthGenMsgs[$key - 1] );
}
* Normally we output all numbers in plain en_US style, that is
* 293,291.235 for twohundredninetythreethousand-twohundredninetyone
* point twohundredthirtyfive. However this is not suitable for all
- * languages, some such as Punjabi want ੨੯੩,੨੯੫.੨੩੫ and others such as
+ * languages, some such as Bengali (bn) want ২,৯৩,২৯১.২৩৫ and others such as
* Icelandic just want to use commas instead of dots, and dots instead
* of commas like "293.291,235".
*
* 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 ) {
} 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 );
}
}
* @return array Array of message keys (strings)
*/
public static function getMessageKeysFor( $code ) {
- return self::getLocalisationCache()->getSubItemList( $code, 'messages' );
+ return self::getLocalisationCache()->getSubitemList( $code, 'messages' );
}
/**