X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=languages%2Fclasses%2FLanguageZh_hans.php;h=3851c8fed5e0aa4b0d00633ca5d5ec091a4d6647;hb=3f28abadc2a070e758e5073e748013f5b78a8b07;hp=d95c42eacca20cf640990f872c681ede31ccbdb1;hpb=50d7729bea870759e3ff9dfc414ea6b22d99d23b;p=lhc%2Fweb%2Fwiklou.git diff --git a/languages/classes/LanguageZh_hans.php b/languages/classes/LanguageZh_hans.php index d95c42eacc..3851c8fed5 100644 --- a/languages/classes/LanguageZh_hans.php +++ b/languages/classes/LanguageZh_hans.php @@ -65,4 +65,33 @@ class LanguageZh_hans extends Language { wfProfileOut( __METHOD__ ); 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 ) { + // Messages: duration-seconds, duration-minutes, duration-hours, duration-days, duration-weeks, + // duration-years, duration-decades, duration-centuries, duration-millennia + $message = wfMessage( 'duration-' . $intervalName )->numParams( $intervalValue ); + $segments[] = $message->inLanguage( $this )->escaped(); + } + + return implode( '', $segments ); + } }