MediaWiki REL1_37
LanguageZh_hans.php
Go to the documentation of this file.
1<?php
29// phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps
34 public function hasWordBreaks() {
35 return false;
36 }
37
47 public function segmentByWord( $string ) {
48 $reg = "/([\\xc0-\\xff][\\x80-\\xbf]*)/";
49 $s = self::insertSpace( $string, $reg );
50 return $s;
51 }
52
57 public 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}
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
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 See https://www.mediawiki.org/wiki/Special:MyLanguage/Localisation for more...
Definition Language.php:42
static insertSpace( $string, $pattern)
getDurationIntervals( $seconds, array $chosenIntervals=[])
Takes a number of seconds and returns an array with a set of corresponding intervals.
foreach( $mmfl['setupFiles'] as $fileName) if($queue) if(empty( $mmfl['quiet'])) $s