MediaWiki master
LanguageZh_hans Class Reference

Simplified Chinese. More...

Inherits MediaWiki\Language\Language.

Inherited by LanguageZh.

Collaboration diagram for LanguageZh_hans:

Public Member Functions

 formatDuration ( $seconds, array $chosenIntervals=[])
 Takes a number of seconds and turns it into a text using values such as hours and minutes.
 
 hasWordBreaks ()
 Most writing systems use whitespace to break up words.
 
 normalizeForSearch ( $s)
 Some languages have special punctuation need to be normalized.
 
 segmentByWord ( $string)
 
- Public Member Functions inherited from MediaWiki\Language\Language
 __construct ( $code=null, ?NamespaceInfo $namespaceInfo=null, ?LocalisationCache $localisationCache=null, ?LanguageNameUtils $langNameUtils=null, ?LanguageFallback $langFallback=null, ?LanguageConverterFactory $converterFactory=null, ?HookContainer $hookContainer=null, ?Config $config=null)
 
 alignEnd ()
 Return 'right' or 'left' as appropriate alignment for line-end for this language's text direction.
 
 alignStart ()
 Return 'left' or 'right' as appropriate alignment for line-start for this language's text direction.
 
 caseFold ( $s)
 Return a case-folded representation of $s.
 
 checkTitleEncoding (string $s)
 
 commaList (array $list)
 Take a list of strings and build a locale-friendly comma-separated list, using the local comma-separator message.
 
 convertForSearchResult ( $termsArray)
 
 convertGrammar ( $word, $case)
 Grammatical transformations, needed for inflected languages Invoked by putting {{grammar:case|word}} in a message.
 
 convertPlural ( $count, $forms)
 Plural form transformations, needed for some languages.
 
 date ( $ts, $adj=false, $format=true, $timecorrection=false)
 
 dateFormat ( $usePrefs=true)
 This is meant to be used by time(), date(), and timeanddate() to get the date preference they're supposed to use.
 
 digitGroupingPattern ()
 
 digitTransformTable ()
 
 embedBidi ( $text='')
 Wraps argument with unicode control characters for directionality safety.
 
 emphasize ( $text)
 Italic is unsuitable for some languages.
 
 equals (Language $lang)
 Compare with another language object.
 
 fallback8bitEncoding ()
 
 firstChar ( $s)
 Get the first character of a string.
 
 formatBitrate ( $bps)
 Format a bitrate for output, using an appropriate unit (bps, kbps, Mbps, Gbps, Tbps, Pbps, Ebps, Zbps, Ybps, Rbps or Qbps) according to the magnitude in question.
 
 formatComputingNumbers ( $size, $boundary, $messageKey)
 
 formatDurationBetweenTimestamps (int $timestamp1, int $timestamp2, ?int $precision=null)
 Takes two timestamps and turns the difference between them into a text using values such as hours and minutes.
 
 formatExpiry ( $expiry, $format=true, $infinity='infinity', $user=null)
 Decode an expiry (block, protection, etc.) which has come from the DB.
 
 formatNum ( $number)
 Normally we output all numbers in plain en_US style, that is 293,291.235 for two hundred ninety-three thousand two hundred ninety-one point two hundred thirty-five.
 
 formatNumNoSeparators ( $number)
 Front-end for non-commafied formatNum.
 
 formatSize ( $size)
 Format a size in bytes for output, using an appropriate unit (B, KB, MB, GB, TB, PB, EB, ZB, YB, RB or QB) according to the magnitude in question.
 
 formatTimePeriod ( $seconds, $format=[])
 Formats a time given in seconds into a string representation of that time.
 
 gender ( $gender, $forms)
 Provides an alternative text depending on specified gender.
 
 getAllMessages ()
 
 getArrow ( $direction='forwards')
 An arrow, depending on the language direction.
 
 getBlockDurations ( $includeOther=true)
 Get an array of suggested block durations from MediaWiki:Ipboptions.
 
 getBookstoreList ()
 Exports $wgBookstoreListEn.
 
 getCode ()
 Get the internal language code for this language object.
 
 getCompiledPluralRules ()
 Get the compiled plural rules for the language.
 
 getDateFormats ()
 
 getDateFormatString ( $type, $pref)
 Get a format string for a given type and preference.
 
 getDatePreferenceMigrationMap ()
 
 getDatePreferences ()
 
 getDefaultDateFormat ()
 
 getDir ()
 Return the correct HTML 'dir' attribute value for this language.
 
 getDirMark ( $opposite=false)
 A hidden direction mark (LRM or RLM), depending on the language direction.
 
 getDirMarkEntity ( $opposite=false)
 A hidden direction mark (LRM or RLM), depending on the language direction.
 
 getDurationIntervals ( $seconds, array $chosenIntervals=[])
 Takes a number of seconds and returns an array with a set of corresponding intervals.
 
 getFallbackLanguages ()
 
 getFormalityIndex ()
 Some languages provide translations in different levels of formality (or manner of address), for example using the T-V distinction.
 
 getFormattedNamespaces ()
 A convenience function that returns getNamespaces() with spaces instead of underscores in values.
 
 getFormattedNsText ( $index)
 A convenience function that returns the same thing as getNsText() except with '_' changed to ' ', useful for producing output.
 
 getGenderNsText ( $index, $gender)
 Returns gender-dependent namespace alias if available.
 
 getGrammarForms ()
 Get the grammar forms for the content language.
 
 getGrammarTransformations ()
 Get the grammar transformations data for the language.
 
 getGroupMemberName (string $group, $member)
 Gets the localized name for a member of a user group if it exists.
 
 getGroupName ( $group)
 Gets the localized friendly name for a group, if it exists.
 
 getHtmlCode ()
 Get the code in BCP 47 format which we can use inside html lang="" tags.
 
 getHumanTimestamp (MWTimestamp $time, ?MWTimestamp $relativeTo=null, ?UserIdentity $user=null)
 Get the timestamp in a human-friendly relative format, e.g., "3 days ago".
 
 getJsData ()
 
 getLocalNsIndex ( $text)
 Get a namespace key by case-insensitive value.
 
 getMagic ( $mw)
 Fill a MagicWord object with data from this instance.
 
 getMagicWords ()
 Get all the magic words from the localisation cache.
 
 getMessage ( $key)
 
 getMessageFromDB ( $msg)
 Get a message from the MediaWiki namespace.
 
 getMonthAbbreviation ( $key)
 
 getMonthAbbreviationsArray ()
 
 getMonthName ( $key)
 
 getMonthNameGen ( $key)
 
 getMonthNamesArray ()
 
 getNamespaceAliases ()
 
 getNamespaceIds ()
 
 getNamespaces ()
 Returns an array of localised namespaces indexed by their numbers.
 
 getNsIndex ( $text)
 Get a namespace key by case-insensitive value.
 
 getNsText ( $index)
 Get a namespace value by key.
 
 getPluralRuleIndexNumber ( $number)
 Find the index number of the plural rule appropriate for the given number.
 
 getPluralRules ()
 Get the plural rules for the language.
 
 getPluralRuleType ( $number)
 Find the plural rule type appropriate for the given number.
 
 getPluralRuleTypes ()
 Get the plural rule types for the language.
 
 getSpecialPageAliases ()
 Get special page names, as an associative array canonical name => array of valid names, including aliases.
 
 getVariantname ( $code, $usemsg=true)
 Short names for language variants used for language conversion links.
 
 getWeekdayAbbreviation ( $key)
 
 getWeekdayName ( $key)
 
 iconv ( $in, $out, $string)
 
 isRTL ()
 For right-to-left language support.
 
 isSameCodeAs (Bcp47Code $other)
 Compare this Language object to a Bcp47Code.
 
 lc ( $str, $first=false)
 
 lcfirst ( $str)
 
 linkPrefixCharset ()
 A regular expression character set to match legal word-prefixing characters which should be merged onto a link of the form foo[[bar]].
 
 linkPrefixExtension ()
 To allow "foo[[bar]]" to extend the link over the whole word "foobar".
 
 linkTrail ()
 A regular expression to match legal word-trailing characters which should be merged onto a link of the form [[foo]]bar.
 
 listToText (array $list)
 Take a list of strings and build a locale-friendly comma-separated list, using the local comma-separator message.
 
 minimumGroupingDigits ()
 The minimum number of digits a number must have, in addition to the grouping size, before grouping separators are added.
 
 needsGenderDistinction ()
 Whether this language uses gender-dependent namespace aliases.
 
 normalize ( $s)
 Convert a UTF-8 string to normal form C.
 
 parseFormattedNumber ( $number)
 
 pipeList (array $list)
 Same as commaList, but separate it with the pipe instead.
 
 resetNamespaces ()
 Resets all the namespace caches.
 
 segmentForDiff ( $text)
 Languages like Chinese need to be segmented in order for the diff to be of any use.
 
 semicolonList (array $list)
 Take a list of strings and build a locale-friendly semicolon-separated list, using the local semicolon-separator message.
 
 separatorTransformTable ()
 
 setNamespaces (array $namespaces)
 Arbitrarily set all the namespace names at once.
 
 specialList ( $page, $details)
 Make a list item, used by various special pages.
 
 sprintfDate ( $format, $ts, ?DateTimeZone $zone=null, &$ttl='unused')
 This is a workalike of PHP's date() function, but with better internationalisation, a reduced set of format characters, and a better escaping format.
 
 time ( $ts, $adj=false, $format=true, $timecorrection=false)
 
 timeanddate ( $ts, $adj=false, $format=true, $timecorrection=false)
 
 toBcp47Code ()
 Implement the Bcp47Code interface.
 
 translateBlockExpiry ( $str, ?UserIdentity $user=null, $now=0)
 
 truncateForDatabase ( $string, $length, $ellipsis='...', $adjustLength=true)
 Truncate a string to a specified length in bytes, appending an optional string (e.g., for ellipsis) When an ellipsis isn't needed, using mb_strcut() directly is recommended.
 
 truncateForVisual ( $string, $length, $ellipsis='...', $adjustLength=true)
 Truncate a string to a specified number of characters, appending an optional string (e.g., for ellipsis).
 
 truncateHtml ( $text, $length, $ellipsis='...')
 Truncate a string of valid HTML to a specified length in bytes, appending an optional string (e.g., for ellipses), and return valid HTML.
 
 uc ( $str, $first=false)
 
 ucfirst ( $str)
 
 ucwordbreaks ( $str)
 capitalize words at word breaks
 
 ucwords ( $str)
 
 unsegmentForDiff ( $text)
 And unsegment to show the result.
 
 userAdjust ( $ts, $tz=false)
 Used by date() and time() to adjust the time output.
 
 userDate ( $ts, UserIdentity $user, array $options=[])
 Get the formatted date for the given timestamp and formatted for the given user.
 
 userTime ( $ts, UserIdentity $user, array $options=[])
 Get the formatted time for the given timestamp and formatted for the given user.
 
 userTimeAndDate ( $ts, UserIdentity $user, array $options=[])
 Get the formatted date and time for the given timestamp and formatted for the given user.
 

Additional Inherited Members

- Static Public Member Functions inherited from MediaWiki\Language\Language
static getCodeFromFileName ( $filename, $prefix='Language', $suffix='.php')
 Get the language code from a file name.
 
static hebrewNumeral ( $num)
 Hebrew Gematria number formatting up to 9999.
 
static romanNumeral ( $num)
 Roman number formatting up to 10000.
 
- Public Attributes inherited from MediaWiki\Language\Language
string[][] $dateFormatStrings = []
 memoize
 
string $mCode
 
string[][] null $mExtendedSpecialPageAliases
 memoize
 
 $mMagicExtensions = []
 
const HEBREW_CALENDAR_MONTH_GENITIVE_MESSAGES
 
const HEBREW_CALENDAR_MONTHS_MESSAGES
 
const HIJRI_CALENDAR_MONTH_MESSAGES
 
const IRANIAN_CALENDAR_MONTHS_MESSAGES
 
const MONTH_ABBREVIATED_MESSAGES
 
const MONTH_GENITIVE_MESSAGES
 
const MONTH_MESSAGES
 
const WEEKDAY_ABBREVIATED_MESSAGES
 
const WEEKDAY_MESSAGES
 
- Static Public Attributes inherited from MediaWiki\Language\Language
static int[] $durationIntervals = self::DURATION_INTERVALS
 
static $mMonthAbbrevMsgs = self::MONTH_ABBREVIATED_MESSAGES
 
static $mMonthMsgs = self::MONTH_MESSAGES
 
- Protected Member Functions inherited from MediaWiki\Language\Language
 getConverterInternal ()
 Return the LanguageConverter for this language, convenience function for use in the language classes only.
 
 getHookContainer ()
 Get a HookContainer, for hook metadata and running extension hooks.
 
 getHookRunner ()
 Get a HookRunner, for running core hooks.
 
 getSearchIndexVariant ()
 Specify the language variant that should be used for search indexing.
 
 handleExplicitPluralForms ( $count, array $forms)
 Handles explicit plural forms for Language::convertPlural()
 
 msg ( $msg,... $params)
 Gets the Message object from this language.
 
 preConvertPlural ($forms, $count)
 Checks that convertPlural was given an array and pads it to requested number of forms by copying the last one.
 
 removeBadCharLast ( $string)
 Remove bytes that represent an incomplete Unicode character at the end of string (e.g.
 
 transformUsingPairFile (string $dataClass, string $input)
 Transform a string using serialized data stored in the given file (which must be in the serialized subdirectory of $IP).
 
- Static Protected Member Functions inherited from MediaWiki\Language\Language
static convertDoubleWidth ( $string)
 Convert double-width roman characters to single-width.
 
static insertSpace ( $string, $pattern)
 
- Protected Attributes inherited from MediaWiki\Language\Language
array< string, int > null $mNamespaceIds
 Indexed by localized lower-cased namespace name.
 
array< string, int > null $namespaceAliases
 Map from alias to namespace ID.
 
array< int, string > null $namespaceNames
 Indexed by numeric namespace ID.
 
const DURATION_INTERVALS
 

Detailed Description

Simplified Chinese.

Definition at line 29 of file LanguageZh_hans.php.

Member Function Documentation

◆ formatDuration()

LanguageZh_hans::formatDuration ( $seconds,
array $chosenIntervals = [] )

Takes a number of seconds and turns it into a text using values such as hours and minutes.

Since
1.20
Parameters
int$secondsThe number of seconds.
array$chosenIntervalsThe intervals to enable.
Returns
string

Reimplemented from MediaWiki\Language\Language.

Definition at line 53 of file LanguageZh_hans.php.

References MediaWiki\Language\Language\getDurationIntervals(), and wfMessage().

◆ hasWordBreaks()

LanguageZh_hans::hasWordBreaks ( )

Most writing systems use whitespace to break up words.

Some languages such as Chinese don't conventionally do this, which requires special handling when breaking up words for searching, etc.

Returns
bool

Reimplemented from MediaWiki\Language\Language.

Definition at line 33 of file LanguageZh_hans.php.

◆ normalizeForSearch()

LanguageZh_hans::normalizeForSearch ( $text)

Some languages have special punctuation need to be normalized.

Make such changes here.

Some languages such as Chinese have many-to-one conversions, e.g., it should be better to use zh-hans for search, since conversion from zh-hant to zh-hans is less ambiguous than the other way around.

Parameters
string$text
Returns
string

Reimplemented from MediaWiki\Language\Language.

Definition at line 46 of file LanguageZh_hans.php.

References segmentByWord().

◆ segmentByWord()

LanguageZh_hans::segmentByWord ( $string)
Todo
FIXME: Only do this for Han characters...

Some languages such as Chinese require word segmentation, Specify such segmentation when overridden in derived class.

Parameters
string$string
Returns
string

Reimplemented from MediaWiki\Language\Language.

Definition at line 42 of file LanguageZh_hans.php.

References MediaWiki\Language\Language\insertSpace().

Referenced by normalizeForSearch().


The documentation for this class was generated from the following file: