MediaWiki REL1_39
LanguageZh_hans.php
Go to the documentation of this file.
1<?php
20// phpcs:ignoreFile Squiz.Classes.ValidClassName.NotCamelCaps
21
31 public function hasWordBreaks() {
32 return false;
33 }
34
44 public function segmentByWord( $string ) {
45 $reg = "/([\\xc0-\\xff][\\x80-\\xbf]*)/";
46 $s = self::insertSpace( $string, $reg );
47 return $s;
48 }
49
54 public function normalizeForSearch( $s ) {
55 // Double-width roman characters
56 $s = parent::normalizeForSearch( $s );
57 $s = trim( $s );
58 $s = $this->segmentByWord( $s );
59
60 return $s;
61 }
62
73 public function formatDuration( $seconds, array $chosenIntervals = [] ) {
74 if ( empty( $chosenIntervals ) ) {
75 $chosenIntervals = [ 'centuries', 'years', 'days', 'hours', 'minutes', 'seconds' ];
76 }
77
78 $intervals = $this->getDurationIntervals( $seconds, $chosenIntervals );
79
80 $segments = [];
81
82 foreach ( $intervals as $intervalName => $intervalValue ) {
83 // Messages: duration-seconds, duration-minutes, duration-hours, duration-days, duration-weeks,
84 // duration-years, duration-decades, duration-centuries, duration-millennia
85 $message = wfMessage( 'duration-' . $intervalName )->numParams( $intervalValue );
86 $segments[] = $message->inLanguage( $this )->escaped();
87 }
88
89 return implode( '', $segments );
90 }
91}
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.
Base class for language-specific code.
Definition Language.php:53
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