MediaWiki REL1_31
LanguageZh_hans.php
Go to the documentation of this file.
1<?php
29// phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps
34 function hasWordBreaks() {
35 return false;
36 }
37
47 function segmentByWord( $string ) {
48 $reg = "/([\\xc0-\\xff][\\x80-\\xbf]*)/";
49 $s = self::insertSpace( $string, $reg );
50 return $s;
51 }
52
57 function normalizeForSearch( $s ) {
58 // Double-width roman characters
59 $s = parent::normalizeForSearch( $s );
60 $s = trim( $s );
61 $s = $this->segmentByWord( $s );
62
63 return $s;
64 }
65
76 public function formatDuration( $seconds, array $chosenIntervals = [] ) {
77 if ( empty( $chosenIntervals ) ) {
78 $chosenIntervals = [ 'centuries', 'years', 'days', 'hours', 'minutes', 'seconds' ];
79 }
80
81 $intervals = $this->getDurationIntervals( $seconds, $chosenIntervals );
82
83 $segments = [];
84
85 foreach ( $intervals as $intervalName => $intervalValue ) {
86 // Messages: duration-seconds, duration-minutes, duration-hours, duration-days, duration-weeks,
87 // duration-years, duration-decades, duration-centuries, duration-millennia
88 $message = wfMessage( 'duration-' . $intervalName )->numParams( $intervalValue );
89 $segments[] = $message->inLanguage( $this )->escaped();
90 }
91
92 return implode( '', $segments );
93 }
94}
Simplified Chinese.
segmentByWord( $string)
Eventually this should be a word segmentation; for now just treat each character as a word.
formatDuration( $seconds, array $chosenIntervals=[])
Takes a number of seconds and turns it into a text using values such as hours and minutes.
Internationalisation code.
Definition Language.php:35
static insertSpace( $string, $pattern)
getDurationIntervals( $seconds, array $chosenIntervals=[])
Takes a number of seconds and returns an array with a set of corresponding intervals.
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "&lt;div ...>$1&lt;/div>"). - flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException':Called before an exception(or PHP error) is logged. This is meant for integration with external error aggregation services