Add LanguageZh_hans::formatDuration() for Chinese.
Change-Id: Idf308e82887fc1d964e08b28904e026d0b2e4217
This commit is contained in:
parent
9a741ee4a0
commit
e88b0fbeb3
1 changed files with 27 additions and 0 deletions
|
|
@ -65,4 +65,31 @@ class LanguageZh_hans extends Language {
|
||||||
wfProfileOut( __METHOD__ );
|
wfProfileOut( __METHOD__ );
|
||||||
return $s;
|
return $s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Takes a number of seconds and turns it into a text using values such as hours and minutes.
|
||||||
|
*
|
||||||
|
* @since 1.21
|
||||||
|
*
|
||||||
|
* @param integer $seconds The amount of seconds.
|
||||||
|
* @param array $chosenIntervals The intervals to enable.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function formatDuration( $seconds, array $chosenIntervals = array() ) {
|
||||||
|
if ( empty( $chosenIntervals ) ) {
|
||||||
|
$chosenIntervals = array( 'centuries', 'years', 'days', 'hours', 'minutes', 'seconds' );
|
||||||
|
}
|
||||||
|
|
||||||
|
$intervals = $this->getDurationIntervals( $seconds, $chosenIntervals );
|
||||||
|
|
||||||
|
$segments = array();
|
||||||
|
|
||||||
|
foreach ( $intervals as $intervalName => $intervalValue ) {
|
||||||
|
$message = new Message( 'duration-' . $intervalName, array( $intervalValue ) );
|
||||||
|
$segments[] = $message->inLanguage( $this )->escaped();
|
||||||
|
}
|
||||||
|
|
||||||
|
return implode( '', $segments );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue