MediaWiki  REL1_24
LanguageZh_hans.php
Go to the documentation of this file.
00001 <?php
00029 // @codingStandardsIgnoreStart Ignore class name is not in camel caps format error
00030 class LanguageZh_hans extends Language {
00031     // @codingStandardsIgnoreEnd
00035     function hasWordBreaks() {
00036         return false;
00037     }
00038 
00048     function segmentByWord( $string ) {
00049         $reg = "/([\\xc0-\\xff][\\x80-\\xbf]*)/";
00050         $s = self::insertSpace( $string, $reg );
00051         return $s;
00052     }
00053 
00058     function normalizeForSearch( $s ) {
00059         wfProfileIn( __METHOD__ );
00060 
00061         // Double-width roman characters
00062         $s = parent::normalizeForSearch( $s );
00063         $s = trim( $s );
00064         $s = $this->segmentByWord( $s );
00065 
00066         wfProfileOut( __METHOD__ );
00067         return $s;
00068     }
00069 
00080     public function formatDuration( $seconds, array $chosenIntervals = array() ) {
00081         if ( empty( $chosenIntervals ) ) {
00082             $chosenIntervals = array( 'centuries', 'years', 'days', 'hours', 'minutes', 'seconds' );
00083         }
00084 
00085         $intervals = $this->getDurationIntervals( $seconds, $chosenIntervals );
00086 
00087         $segments = array();
00088 
00089         foreach ( $intervals as $intervalName => $intervalValue ) {
00090             // Messages: duration-seconds, duration-minutes, duration-hours, duration-days, duration-weeks,
00091             // duration-years, duration-decades, duration-centuries, duration-millennia
00092             $message = wfMessage( 'duration-' . $intervalName )->numParams( $intervalValue );
00093             $segments[] = $message->inLanguage( $this )->escaped();
00094         }
00095 
00096         return implode( '', $segments );
00097     }
00098 }