X-Git-Url: https://scripts.mit.edu/gitweb/autoinstallsdev/mediawiki.git/blobdiff_plain/19e297c21b10b1b8a3acad5e73fc71dcb35db44a..6932310fd58ebef145fa01eb76edf7150284d8ea:/languages/classes/LanguageZh_hans.php diff --git a/languages/classes/LanguageZh_hans.php b/languages/classes/LanguageZh_hans.php index a65162bc..9d81c213 100644 --- a/languages/classes/LanguageZh_hans.php +++ b/languages/classes/LanguageZh_hans.php @@ -1,11 +1,37 @@ segmentByWord( $s ); - 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 int $seconds The amount of seconds. + * @param array $chosenIntervals The intervals to enable. + * + * @return string + */ + public function formatDuration( $seconds, array $chosenIntervals = [] ) { + if ( empty( $chosenIntervals ) ) { + $chosenIntervals = [ 'centuries', 'years', 'days', 'hours', 'minutes', 'seconds' ]; + } + + $intervals = $this->getDurationIntervals( $seconds, $chosenIntervals ); + + $segments = []; + + 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 ); + } }