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