MediaWiki REL1_41
LanguageZh Class Reference

Chinese-specific code. More...

Inherits LanguageZh_hans.

Inherited by LanguageGan, and LanguageWuu.

Collaboration diagram for LanguageZh:

Public Member Functions

 convertForSearchResult ( $termsArray)
 
 segmentForDiff ( $text)
 Add a formfeed character between each non-ASCII character, so that "word-level" diffs will effectively operate on a character level.
 
 unsegmentForDiff ( $text)
 And unsegment to show the result.
 
- Public Member Functions inherited from LanguageZh_hans
 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 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 ( $s)
 TODO: $s is not always a string per T218883.
 
 commaList (array $list)
 Take a list of strings and build a locale-friendly comma-separated list, using the local comma-separator message.
 
 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)
 
 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.
 
 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 ()
 
 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.
 
 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, $oppositedm=true)
 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)
 
 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.
 

Protected Member Functions

 getSearchIndexVariant ()
 Specify the language variant that should be used for search indexing.
 
- Protected Member Functions inherited from 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.
 
 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).
 

Additional Inherited Members

- Static Public Member Functions inherited from 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 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 Language
static int[] $durationIntervals = self::DURATION_INTERVALS
 
static $mMonthAbbrevMsgs = self::MONTH_ABBREVIATED_MESSAGES
 
static $mMonthMsgs = self::MONTH_MESSAGES
 
- Static Protected Member Functions inherited from Language
static convertDoubleWidth ( $string)
 Convert double-width roman characters to single-width.
 
static insertSpace ( $string, $pattern)
 
- Protected Attributes inherited from 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

Chinese-specific code.

This handles both Traditional and Simplified Chinese. Right now, we distinguish zh_hans, zh_hant, zh_cn, zh_tw, zh_sg, and zh_hk.

Definition at line 30 of file LanguageZh.php.

Member Function Documentation

◆ convertForSearchResult()

LanguageZh::convertForSearchResult ( $termsArray)
Parameters
string[]$termsArray
Returns
string[]

Reimplemented from Language.

Definition at line 58 of file LanguageZh.php.

References Language\convertDoubleWidth(), and Language\getConverterInternal().

◆ getSearchIndexVariant()

LanguageZh::getSearchIndexVariant ( )
protected

Specify the language variant that should be used for search indexing.

Returns
string|null

Reimplemented from Language.

Reimplemented in LanguageGan, and LanguageWuu.

Definition at line 54 of file LanguageZh.php.

◆ segmentForDiff()

LanguageZh::segmentForDiff ( $text)

Add a formfeed character between each non-ASCII character, so that "word-level" diffs will effectively operate on a character level.

The FF characters are stripped out by unsegmentForDiff().

We use FF because it is the least used character that is matched by PCRE's \s class.

In the unlikely event that an FF character appears in the input, it will be displayed in the diff as a replacement character.

Parameters
string$text
Returns
string

Reimplemented from Language.

Definition at line 45 of file LanguageZh.php.

◆ unsegmentForDiff()

LanguageZh::unsegmentForDiff ( $text)

And unsegment to show the result.

Parameters
string$text
Returns
string

Reimplemented from Language.

Definition at line 50 of file LanguageZh.php.


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