[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/languages/ -> Language.php (summary)

Internationalisation code. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

File Size: 4784 lines (141 kb)
Included or required:0 times
Referenced: 1 time
Includes or requires: 0 files

Defines 1 class

Language:: (201 methods):
  factory()
  newFromCode()
  isSupportedLanguage()
  isWellFormedLanguageTag()
  isValidCode()
  isValidBuiltInCode()
  isKnownLanguageTag()
  classFromCode()
  preloadLanguageClass()
  getLocalisationCache()
  __construct()
  __destruct()
  initContLang()
  getFallbackLanguages()
  getBookstoreList()
  getNamespaces()
  setNamespaces()
  resetNamespaces()
  getFormattedNamespaces()
  getNsText()
  getFormattedNsText()
  getGenderNsText()
  needsGenderDistinction()
  getLocalNsIndex()
  getNamespaceAliases()
  getNamespaceIds()
  getNsIndex()
  getVariantname()
  specialPage()
  getDatePreferences()
  getDateFormats()
  getDefaultDateFormat()
  getDatePreferenceMigrationMap()
  getImageFile()
  getImageFiles()
  getExtraUserToggles()
  getUserToggle()
  getLanguageNames()
  getTranslatedLanguageNames()
  fetchLanguageNames()
  fetchLanguageName()
  getMessageFromDB()
  getLanguageName()
  getMonthName()
  getMonthNamesArray()
  getMonthNameGen()
  getMonthAbbreviation()
  getMonthAbbreviationsArray()
  getWeekdayName()
  getWeekdayAbbreviation()
  getIranianCalendarMonthName()
  getHebrewCalendarMonthName()
  getHebrewCalendarMonthNameGen()
  getHijriCalendarMonthName()
  dateTimeObjFormat()
  sprintfDate()
  tsToIranian()
  tsToHijri()
  tsToHebrew()
  hebrewYearStart()
  tsToYear()
  romanNumeral()
  hebrewNumeral()
  userAdjust()
  dateFormat()
  getDateFormatString()
  date()
  time()
  timeanddate()
  formatDuration()
  getDurationIntervals()
  internalUserTimeAndDate()
  userDate()
  userTime()
  userTimeAndDate()
  getHumanTimestamp()
  getMessage()
  getAllMessages()
  iconv()
  ucwordbreaksCallbackAscii()
  ucwordbreaksCallbackMB()
  ucCallback()
  lcCallback()
  ucwordsCallbackMB()
  ucwordsCallbackWiki()
  ucfirst()
  uc()
  lcfirst()
  lc()
  isMultibyte()
  ucwords()
  ucwordbreaks()
  caseFold()
  checkTitleEncoding()
  fallback8bitEncoding()
  hasWordBreaks()
  segmentByWord()
  normalizeForSearch()
  convertDoubleWidth()
  insertSpace()
  convertForSearchResult()
  firstChar()
  initEncoding()
  recodeForEdit()
  recodeInput()
  normalize()
  transformUsingPairFile()
  isRTL()
  getDir()
  alignStart()
  alignEnd()
  getDirMarkEntity()
  getDirMark()
  capitalizeAllNouns()
  getArrow()
  linkPrefixExtension()
  getMagicWords()
  doMagicHook()
  getMagic()
  addMagicWordsByLang()
  getSpecialPageAliases()
  emphasize()
  formatNum()
  formatNumNoSeparators()
  parseFormattedNumber()
  commafy()
  digitGroupingPattern()
  digitTransformTable()
  separatorTransformTable()
  listToText()
  commaList()
  semicolonList()
  pipeList()
  truncate()
  removeBadCharLast()
  removeBadCharFirst()
  truncateHtml()
  truncate_skip()
  truncate_endBracket()
  convertGrammar()
  getGrammarForms()
  gender()
  convertPlural()
  handleExplicitPluralForms()
  preConvertPlural()
  translateBlockExpiry()
  segmentForDiff()
  unsegmentForDiff()
  getConverter()
  autoConvertToAllVariants()
  convert()
  convertTitle()
  convertNamespace()
  hasVariants()
  hasVariant()
  armourMath()
  convertHtml()
  convertCategoryKey()
  getVariants()
  getPreferredVariant()
  getDefaultVariant()
  getURLVariant()
  findVariantLink()
  getExtraHashOptions()
  getParsedTitle()
  markNoConversion()
  linkTrail()
  linkPrefixCharset()
  getLangObj()
  getParentLanguage()
  getCode()
  getHtmlCode()
  setCode()
  getFileName()
  getCodeFromFileName()
  getMessagesFileName()
  getJsonMessagesFileName()
  getClassFileName()
  getFallbackFor()
  getFallbacksFor()
  getFallbacksIncludingSiteLanguage()
  getMessagesFor()
  getMessageFor()
  getMessageKeysFor()
  fixVariableInNamespace()
  replaceGrammarInNamespace()
  getCaseMaps()
  formatExpiry()
  formatTimePeriod()
  formatBitrate()
  formatComputingNumbers()
  formatSize()
  specialList()
  viewPrevNext()
  numLink()
  getConvRuleTitle()
  getCompiledPluralRules()
  getPluralRules()
  getPluralRuleTypes()
  getPluralRuleIndexNumber()
  getPluralRuleType()


Class: Language  - X-Ref

Internationalisation code

factory( $code )   X-Ref
Get a cached or new language object for a given language code

param: string $code
return: Language

newFromCode( $code )   X-Ref
Create a language object for a given language code

param: string $code
return: Language

isSupportedLanguage( $code )   X-Ref
Checks whether any localisation is available for that language tag
in MediaWiki (MessagesXx.php exists).

param: string $code Language tag (in lower case)
return: bool Whether language is supported

isWellFormedLanguageTag( $code, $lenient = false )   X-Ref
Returns true if a language code string is a well-formed language tag
according to RFC 5646.
This function only checks well-formedness; it doesn't check that
language, script or variant codes actually exist in the repositories.

Based on regexes by Mark Davis of the Unicode Consortium:
http://unicode.org/repos/cldr/trunk/tools/java/org/unicode/cldr/util/data/langtagRegex.txt

param: string $code
param: bool $lenient Whether to allow '_' as separator. The default is only '-'.
return: bool

isValidCode( $code )   X-Ref
Returns true if a language code string is of a valid form, whether or
not it exists. This includes codes which are used solely for
customisation via the MediaWiki namespace.

param: string $code
return: bool

isValidBuiltInCode( $code )   X-Ref
Returns true if a language code is of a valid form for the purposes of
internal customisation of MediaWiki, via Messages*.php or *.json.

param: string $code
return: bool

isKnownLanguageTag( $tag )   X-Ref
Returns true if a language code is an IETF tag known to MediaWiki.

param: string $tag
return: bool

classFromCode( $code )   X-Ref

param: string $code
return: string Name of the language class

preloadLanguageClass( $class )   X-Ref
Includes language class files

param: string $class Name of the language class

getLocalisationCache()   X-Ref
Get the LocalisationCache instance

return: LocalisationCache

__construct()   X-Ref
No description

__destruct()   X-Ref
Reduce memory usage


initContLang()   X-Ref
Hook which will be called if this is the content language.
Descendants can use this to register hook functions or modify globals


getFallbackLanguages()   X-Ref

return: array

getBookstoreList()   X-Ref
Exports $wgBookstoreListEn

return: array

getNamespaces()   X-Ref
Returns an array of localised namespaces indexed by their numbers. If the namespace is not
available in localised form, it will be included in English.

return: array

setNamespaces( array $namespaces )   X-Ref
Arbitrarily set all of the namespace names at once. Mainly used for testing

param: array $namespaces Array of namespaces (id => name)

resetNamespaces()   X-Ref
Resets all of the namespace caches. Mainly used for testing


getFormattedNamespaces()   X-Ref
A convenience function that returns the same thing as
getNamespaces() except with the array values changed to ' '
where it found '_', useful for producing output to be displayed
e.g. in <select> forms.

return: array

getNsText( $index )   X-Ref
Get a namespace value by key
<code>
$mw_ns = $wgContLang->getNsText( NS_MEDIAWIKI );
echo $mw_ns; // prints 'MediaWiki'
</code>

param: int $index The array key of the namespace to return
return: string|bool String if the namespace value exists, otherwise false

getFormattedNsText( $index )   X-Ref
A convenience function that returns the same thing as
getNsText() except with '_' changed to ' ', useful for
producing output.

<code>
$mw_ns = $wgContLang->getFormattedNsText( NS_MEDIAWIKI_TALK );
echo $mw_ns; // prints 'MediaWiki talk'
</code>

param: int $index The array key of the namespace to return
return: string Namespace name without underscores (empty string if namespace does not exist)

getGenderNsText( $index, $gender )   X-Ref
Returns gender-dependent namespace alias if available.
See https://www.mediawiki.org/wiki/Manual:$wgExtraGenderNamespaces

param: int $index Namespace index
param: string $gender Gender key (male, female... )
return: string

needsGenderDistinction()   X-Ref
Whether this language uses gender-dependent namespace aliases.
See https://www.mediawiki.org/wiki/Manual:$wgExtraGenderNamespaces

return: bool

getLocalNsIndex( $text )   X-Ref
Get a namespace key by value, case insensitive.
Only matches namespace names for the current language, not the
canonical ones defined in Namespace.php.

param: string $text
return: int|bool An integer if $text is a valid value otherwise false

getNamespaceAliases()   X-Ref

return: array

getNamespaceIds()   X-Ref

return: array

getNsIndex( $text )   X-Ref
Get a namespace key by value, case insensitive.  Canonical namespace
names override custom ones defined for the current language.

param: string $text
return: int|bool An integer if $text is a valid value otherwise false

getVariantname( $code, $usemsg = true )   X-Ref
short names for language variants used for language conversion links.

param: string $code
param: bool $usemsg Use the "variantname-xyz" message if it exists
return: string

specialPage( $name )   X-Ref

param: string $name
return: string

getDatePreferences()   X-Ref

return: array

getDateFormats()   X-Ref

return: array

getDefaultDateFormat()   X-Ref

return: array|string

getDatePreferenceMigrationMap()   X-Ref

return: array

getImageFile( $image )   X-Ref

param: string $image
return: array|null

getImageFiles()   X-Ref

return: array

getExtraUserToggles()   X-Ref

return: array

getUserToggle( $tog )   X-Ref

param: string $tog
return: string

getLanguageNames( $customisedOnly = false )   X-Ref
Get native language names, indexed by code.
Only those defined in MediaWiki, no other data like CLDR.
If $customisedOnly is true, only returns codes with a messages file

param: bool $customisedOnly
return: array

getTranslatedLanguageNames( $code )   X-Ref
Get translated language names. This is done on best effort and
by default this is exactly the same as Language::getLanguageNames.
The CLDR extension provides translated names.

param: string $code Language code.
return: array Language code => language name

fetchLanguageNames( $inLanguage = null, $include = 'mw' )   X-Ref
Get an array of language names, indexed by code.

param: null|string $inLanguage Code of language in which to return the names
param: string $include One of:
return: array Language code => language name

fetchLanguageName( $code, $inLanguage = null, $include = 'all' )   X-Ref

param: string $code The code of the language for which to get the name
param: null|string $inLanguage Code of language in which to return the name (null for autonyms)
param: string $include 'all', 'mw' or 'mwfile'; see fetchLanguageNames()
return: string Language name or empty

getMessageFromDB( $msg )   X-Ref
Get a message from the MediaWiki namespace.

param: string $msg Message name
return: string

getLanguageName( $code )   X-Ref
Get the native language name of $code.
Only if defined in MediaWiki, no other data like CLDR.

param: string $code
return: string

getMonthName( $key )   X-Ref

param: string $key
return: string

getMonthNamesArray()   X-Ref

return: array

getMonthNameGen( $key )   X-Ref

param: string $key
return: string

getMonthAbbreviation( $key )   X-Ref

param: string $key
return: string

getMonthAbbreviationsArray()   X-Ref

return: array

getWeekdayName( $key )   X-Ref

param: string $key
return: string

getWeekdayAbbreviation( $key )   X-Ref

param: string $key
return: string

getIranianCalendarMonthName( $key )   X-Ref

param: string $key
return: string

getHebrewCalendarMonthName( $key )   X-Ref

param: string $key
return: string

getHebrewCalendarMonthNameGen( $key )   X-Ref

param: string $key
return: string

getHijriCalendarMonthName( $key )   X-Ref

param: string $key
return: string

dateTimeObjFormat( &$dateTimeObj, $ts, $zone, $code )   X-Ref
Pass through result from $dateTimeObj->format()

param: DateTime|bool|null &$dateTimeObj
param: string $ts
param: DateTimeZone|bool|null $zone
param: string $code
return: string

sprintfDate( $format, $ts, DateTimeZone $zone = null, &$ttl = null )   X-Ref
This is a workalike of PHP's date() function, but with better
internationalisation, a reduced set of format characters, and a better
escaping format.

Supported format characters are dDjlNwzWFmMntLoYyaAgGhHiscrUeIOPTZ. See
the PHP manual for definitions. There are a number of extensions, which
start with "x":

xn   Do not translate digits of the next numeric format character
xN   Toggle raw digit (xn) flag, stays set until explicitly unset
xr   Use roman numerals for the next numeric format character
xh   Use hebrew numerals for the next numeric format character
xx   Literal x
xg   Genitive month name

xij  j (day number) in Iranian calendar
xiF  F (month name) in Iranian calendar
xin  n (month number) in Iranian calendar
xiy  y (two digit year) in Iranian calendar
xiY  Y (full year) in Iranian calendar

xjj  j (day number) in Hebrew calendar
xjF  F (month name) in Hebrew calendar
xjt  t (days in month) in Hebrew calendar
xjx  xg (genitive month name) in Hebrew calendar
xjn  n (month number) in Hebrew calendar
xjY  Y (full year) in Hebrew calendar

xmj  j (day number) in Hijri calendar
xmF  F (month name) in Hijri calendar
xmn  n (month number) in Hijri calendar
xmY  Y (full year) in Hijri calendar

xkY  Y (full year) in Thai solar calendar. Months and days are
identical to the Gregorian calendar
xoY  Y (full year) in Minguo calendar or Juche year.
Months and days are identical to the
Gregorian calendar
xtY  Y (full year) in Japanese nengo. Months and days are
identical to the Gregorian calendar

Characters enclosed in double quotes will be considered literal (with
the quotes themselves removed). Unmatched quotes will be considered
literal quotes. Example:

"The month is" F       => The month is January
i's"                   => 20'11"

Backslash escaping is also supported.

Input timestamp is assumed to be pre-normalized to the desired local
time zone, if any. Note that the format characters crUeIOPTZ will assume
$ts is UTC if $zone is not given.

param: string $format
param: string $ts 14-character timestamp
param: DateTimeZone $zone Timezone of $ts
param: [out] int $ttl The amount of time (in seconds) the output may be cached for.
return: string

tsToIranian( $ts )   X-Ref
Algorithm by Roozbeh Pournader and Mohammad Toossi to convert
Gregorian dates to Iranian dates. Originally written in C, it
is released under the terms of GNU Lesser General Public
License. Conversion to PHP was performed by Niklas Laxström.

Link: http://www.farsiweb.info/jalali/jalali.c

param: string $ts
return: string

tsToHijri( $ts )   X-Ref
Converting Gregorian dates to Hijri dates.

Based on a PHP-Nuke block by Sharjeel which is released under GNU/GPL license

param: string $ts
return: string

tsToHebrew( $ts )   X-Ref
Converting Gregorian dates to Hebrew dates.

Based on a JavaScript code by Abu Mami and Yisrael Hersch
([email protected], http://www.kaluach.net), who permitted
to translate the relevant functions into PHP and release them under
GNU GPL.

The months are counted from Tishrei = 1. In a leap year, Adar I is 13
and Adar II is 14. In a non-leap year, Adar is 6.

param: string $ts
return: string

hebrewYearStart( $year )   X-Ref
This calculates the Hebrew year start, as days since 1 September.
Based on Carl Friedrich Gauss algorithm for finding Easter date.
Used for Hebrew date.

param: int $year
return: string

tsToYear( $ts, $cName )   X-Ref
Algorithm to convert Gregorian dates to Thai solar dates,
Minguo dates or Minguo dates.

Link: http://en.wikipedia.org/wiki/Thai_solar_calendar
http://en.wikipedia.org/wiki/Minguo_calendar
http://en.wikipedia.org/wiki/Japanese_era_name

param: string $ts 14-character timestamp
param: string $cName Calender name
return: array Converted year, month, day

romanNumeral( $num )   X-Ref
Roman number formatting up to 10000

param: int $num
return: string

hebrewNumeral( $num )   X-Ref
Hebrew Gematria number formatting up to 9999

param: int $num
return: string

userAdjust( $ts, $tz = false )   X-Ref
Used by date() and time() to adjust the time output.

param: string $ts The time in date('YmdHis') format
param: mixed $tz Adjust the time by this amount (default false, mean we
return: int

dateFormat( $usePrefs = true )   X-Ref
This is meant to be used by time(), date(), and timeanddate() to get
the date preference they're supposed to use, it should be used in
all children.

<code>
function timeanddate([...], $format = true) {
$datePreference = $this->dateFormat($format);
[...]
}
</code>

param: int|string|bool $usePrefs If true, the user's preference is used
return: string

getDateFormatString( $type, $pref )   X-Ref
Get a format string for a given type and preference

param: string $type May be date, time or both
param: string $pref The format name as it appears in Messages*.php
return: string

date( $ts, $adj = false, $format = true, $timecorrection = false )   X-Ref

param: string $ts The time format which needs to be turned into a
param: bool $adj Whether to adjust the time output according to the
param: mixed $format True to use user's date format preference
param: string|bool $timecorrection The time offset as returned by
return: string

time( $ts, $adj = false, $format = true, $timecorrection = false )   X-Ref

param: string $ts The time format which needs to be turned into a
param: bool $adj Whether to adjust the time output according to the
param: mixed $format True to use user's date format preference
param: string|bool $timecorrection The time offset as returned by
return: string

timeanddate( $ts, $adj = false, $format = true, $timecorrection = false )   X-Ref

param: string $ts The time format which needs to be turned into a
param: bool $adj Whether to adjust the time output according to the
param: mixed $format What format to return, if it's false output the
param: string|bool $timecorrection The time offset as returned by
return: string

formatDuration( $seconds, array $chosenIntervals = array()   X-Ref
Takes a number of seconds and turns it into a text using values such as hours and minutes.

param: int $seconds The amount of seconds.
param: array $chosenIntervals The intervals to enable.
return: string

getDurationIntervals( $seconds, array $chosenIntervals = array()   X-Ref
Takes a number of seconds and returns an array with a set of corresponding intervals.
For example 65 will be turned into array( minutes => 1, seconds => 5 ).

param: int $seconds The amount of seconds.
param: array $chosenIntervals The intervals to enable.
return: array

internalUserTimeAndDate( $type, $ts, User $user, array $options )   X-Ref
Internal helper function for userDate(), userTime() and userTimeAndDate()

param: string $type Can be 'date', 'time' or 'both'
param: string $ts The time format which needs to be turned into a
param: User $user User object used to get preferences for timezone and format
param: array $options Array, can contain the following keys:
return: string

userDate( $ts, User $user, array $options = array()   X-Ref
Get the formatted date for the given timestamp and formatted for
the given user.

param: mixed $ts Mixed: the time format which needs to be turned into a
param: User $user User object used to get preferences for timezone and format
param: array $options Array, can contain the following keys:
return: string

userTime( $ts, User $user, array $options = array()   X-Ref
Get the formatted time for the given timestamp and formatted for
the given user.

param: mixed $ts The time format which needs to be turned into a
param: User $user User object used to get preferences for timezone and format
param: array $options Array, can contain the following keys:
return: string

userTimeAndDate( $ts, User $user, array $options = array()   X-Ref
Get the formatted date and time for the given timestamp and formatted for
the given user.

param: mixed $ts The time format which needs to be turned into a
param: User $user User object used to get preferences for timezone and format
param: array $options Array, can contain the following keys:
return: string

getHumanTimestamp( MWTimestamp $ts, MWTimestamp $relativeTo, User $user )   X-Ref
Convert an MWTimestamp into a pretty human-readable timestamp using
the given user preferences and relative base time.

DO NOT USE THIS FUNCTION DIRECTLY. Instead, call MWTimestamp::getHumanTimestamp
on your timestamp object, which will then call this function. Calling
this function directly will cause hooks to be skipped over.

param: MWTimestamp $ts Timestamp to prettify
param: MWTimestamp $relativeTo Base timestamp
param: User $user User preferences to use
return: string Human timestamp

getMessage( $key )   X-Ref

param: string $key
return: array|null

getAllMessages()   X-Ref

return: array

iconv( $in, $out, $string )   X-Ref

param: string $in
param: string $out
param: string $string
return: string

ucwordbreaksCallbackAscii( $matches )   X-Ref

param: array $matches
return: mixed|string

ucwordbreaksCallbackMB( $matches )   X-Ref

param: array $matches
return: string

ucCallback( $matches )   X-Ref

param: array $matches
return: string

lcCallback( $matches )   X-Ref

param: array $matches
return: string

ucwordsCallbackMB( $matches )   X-Ref

param: array $matches
return: string

ucwordsCallbackWiki( $matches )   X-Ref

param: array $matches
return: string

ucfirst( $str )   X-Ref
Make a string's first character uppercase

param: string $str
return: string

uc( $str, $first = false )   X-Ref
Convert a string to uppercase

param: string $str
param: bool $first
return: string

lcfirst( $str )   X-Ref

param: string $str
return: mixed|string

lc( $str, $first = false )   X-Ref

param: string $str
param: bool $first
return: mixed|string

isMultibyte( $str )   X-Ref

param: string $str
return: bool

ucwords( $str )   X-Ref

param: string $str
return: mixed|string

ucwordbreaks( $str )   X-Ref
capitalize words at word breaks

param: string $str
return: mixed

caseFold( $s )   X-Ref
Return a case-folded representation of $s

This is a representation such that caseFold($s1)==caseFold($s2) if $s1
and $s2 are the same except for the case of their characters. It is not
necessary for the value returned to make sense when displayed.

Do *not* perform any other normalisation in this function. If a caller
uses this function when it should be using a more general normalisation
function, then fix the caller.

param: string $s
return: string

checkTitleEncoding( $s )   X-Ref

param: string $s
return: string

fallback8bitEncoding()   X-Ref

return: array

hasWordBreaks()   X-Ref
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.

return: bool

segmentByWord( $string )   X-Ref
Some languages such as Chinese require word segmentation,
Specify such segmentation when overridden in derived class.

param: string $string
return: string

normalizeForSearch( $string )   X-Ref
Some languages have special punctuation need to be normalized.
Make such changes here.

param: string $string
return: string

convertDoubleWidth( $string )   X-Ref
convert double-width roman characters to single-width.
range: ff00-ff5f ~= 0020-007f

param: string $string
return: string

insertSpace( $string, $pattern )   X-Ref

param: string $string
param: string $pattern
return: string

convertForSearchResult( $termsArray )   X-Ref

param: array $termsArray
return: array

firstChar( $s )   X-Ref
Get the first character of a string.

param: string $s
return: string

initEncoding()   X-Ref
No description

recodeForEdit( $s )   X-Ref

param: string $s
return: string

recodeInput( $s )   X-Ref

param: string $s
return: string

normalize( $s )   X-Ref
Convert a UTF-8 string to normal form C. In Malayalam and Arabic, this
also cleans up certain backwards-compatible sequences, converting them
to the modern Unicode equivalent.

This is language-specific for performance reasons only.

param: string $s
return: string

transformUsingPairFile( $file, $string )   X-Ref
Transform a string using serialized data stored in the given file (which
must be in the serialized subdirectory of $IP). The file contains pairs
mapping source characters to destination characters.

The data is cached in process memory. This will go faster if you have the
FastStringSearch extension.

param: string $file
param: string $string
return: string

isRTL()   X-Ref
For right-to-left language support

return: bool

getDir()   X-Ref
Return the correct HTML 'dir' attribute value for this language.

return: string

alignStart()   X-Ref
Return 'left' or 'right' as appropriate alignment for line-start
for this language's text direction.

Should be equivalent to CSS3 'start' text-align value....

return: string

alignEnd()   X-Ref
Return 'right' or 'left' as appropriate alignment for line-end
for this language's text direction.

Should be equivalent to CSS3 'end' text-align value....

return: string

getDirMarkEntity( $opposite = false )   X-Ref
A hidden direction mark (LRM or RLM), depending on the language direction.
Unlike getDirMark(), this function returns the character as an HTML entity.
This function should be used when the output is guaranteed to be HTML,
because it makes the output HTML source code more readable. When
the output is plain text or can be escaped, getDirMark() should be used.

param: bool $opposite Get the direction mark opposite to your language
return: string

getDirMark( $opposite = false )   X-Ref
A hidden direction mark (LRM or RLM), depending on the language direction.
This function produces them as invisible Unicode characters and
the output may be hard to read and debug, so it should only be used
when the output is plain text or can be escaped. When the output is
HTML, use getDirMarkEntity() instead.

param: bool $opposite Get the direction mark opposite to your language
return: string

capitalizeAllNouns()   X-Ref

return: array

getArrow( $direction = 'forwards' )   X-Ref
An arrow, depending on the language direction.

param: string $direction The direction of the arrow: forwards (default),
return: string

linkPrefixExtension()   X-Ref
To allow "foo[[bar]]" to extend the link over the whole word "foobar"

return: bool

getMagicWords()   X-Ref
Get all magic words from cache.

return: array

doMagicHook()   X-Ref
Run the LanguageGetMagic hook once.


getMagic( $mw )   X-Ref
Fill a MagicWord object with data from here

param: MagicWord $mw

addMagicWordsByLang( $newWords )   X-Ref
Add magic words to the extension array

param: array $newWords

getSpecialPageAliases()   X-Ref
Get special page names, as an associative array
case folded alias => real name

return: array

emphasize( $text )   X-Ref
Italic is unsuitable for some languages

param: string $text The text to be emphasized.
return: string

formatNum( $number, $nocommafy = false )   X-Ref
Normally we output all numbers in plain en_US style, that is
293,291.235 for twohundredninetythreethousand-twohundredninetyone
point twohundredthirtyfive. However this is not suitable for all
languages, some such as Punjabi want ੨੯੩,੨੯੫.੨੩੫ and others such as
Icelandic just want to use commas instead of dots, and dots instead
of commas like "293.291,235".

An example of this function being called:
<code>
wfMessage( 'message' )->numParams( $num )->text()
</code>

See $separatorTransformTable on MessageIs.php for
the , => . and . => , implementation.

param: int|float $number The string to be formatted, should be an integer
param: bool $nocommafy Set to true for special numbers like dates
return: string

formatNumNoSeparators( $number )   X-Ref
Front-end for non-commafied formatNum

param: int|float $number The string to be formatted, should be an integer
return: string

parseFormattedNumber( $number )   X-Ref

param: string $number
return: string

commafy( $number )   X-Ref
Adds commas to a given number

param: mixed $number
return: string

digitGroupingPattern()   X-Ref

return: string

digitTransformTable()   X-Ref

return: array

separatorTransformTable()   X-Ref

return: array

listToText( array $l )   X-Ref
Take a list of strings and build a locale-friendly comma-separated
list, using the local comma-separator message.
The last two strings are chained with an "and".
NOTE: This function will only work with standard numeric array keys (0, 1, 2…)

param: string[] $l
return: string

commaList( array $list )   X-Ref
Take a list of strings and build a locale-friendly comma-separated
list, using the local comma-separator message.

param: string[] $list Array of strings to put in a comma list
return: string

semicolonList( array $list )   X-Ref
Take a list of strings and build a locale-friendly semicolon-separated
list, using the local semicolon-separator message.

param: string[] $list Array of strings to put in a semicolon list
return: string

pipeList( array $list )   X-Ref
Same as commaList, but separate it with the pipe instead.

param: string[] $list Array of strings to put in a pipe list
return: string

truncate( $string, $length, $ellipsis = '...', $adjustLength = true )   X-Ref
Truncate a string to a specified length in bytes, appending an optional
string (e.g. for ellipses)

The database offers limited byte lengths for some columns in the database;
multi-byte character sets mean we need to ensure that only whole characters
are included, otherwise broken characters can be passed to the user

If $length is negative, the string will be truncated from the beginning

param: string $string String to truncate
param: int $length Maximum length (including ellipses)
param: string $ellipsis String to append to the truncated text
param: bool $adjustLength Subtract length of ellipsis from $length.
return: string

removeBadCharLast( $string )   X-Ref
Remove bytes that represent an incomplete Unicode character
at the end of string (e.g. bytes of the char are missing)

param: string $string
return: string

removeBadCharFirst( $string )   X-Ref
Remove bytes that represent an incomplete Unicode character
at the start of string (e.g. bytes of the char are missing)

param: string $string
return: string

truncateHtml( $text, $length, $ellipsis = '...' )   X-Ref
Truncate a string of valid HTML to a specified length in bytes,
appending an optional string (e.g. for ellipses), and return valid HTML

This is only intended for styled/linked text, such as HTML with
tags like <span> and <a>, were the tags are self-contained (valid HTML).
Also, this will not detect things like "display:none" CSS.

Note: since 1.18 you do not need to leave extra room in $length for ellipses.

param: string $text HTML string to truncate
param: int $length (zero/positive) Maximum length (including ellipses)
param: string $ellipsis String to append to the truncated text
return: string

truncate_skip( &$ret, $text, $search, $start, $len = null )   X-Ref
truncateHtml() helper function
like strcspn() but adds the skipped chars to $ret

param: string $ret
param: string $text
param: string $search
param: int $start
param: null|int $len
return: int

truncate_endBracket( &$tag, $tagType, $lastCh, &$openTags )   X-Ref
truncateHtml() helper function
(a) push or pop $tag from $openTags as needed
(b) clear $tag value

param: string &$tag Current HTML tag name we are looking at
param: int $tagType (0-open tag, 1-close tag)
param: string $lastCh Character before the '>' that ended this tag
param: array &$openTags Open tag stack (not accounting for $tag)

convertGrammar( $word, $case )   X-Ref
Grammatical transformations, needed for inflected languages
Invoked by putting {{grammar:case|word}} in a message

param: string $word
param: string $case
return: string

getGrammarForms()   X-Ref
Get the grammar forms for the content language

return: array Array of grammar forms

gender( $gender, $forms )   X-Ref
Provides an alternative text depending on specified gender.
Usage {{gender:username|masculine|feminine|unknown}}.
username is optional, in which case the gender of current user is used,
but only in (some) interface messages; otherwise default gender is used.

If no forms are given, an empty string is returned. If only one form is
given, it will be returned unconditionally. These details are implied by
the caller and cannot be overridden in subclasses.

If three forms are given, the default is to use the third (unknown) form.
If fewer than three forms are given, the default is to use the first (masculine) form.
These details can be overridden in subclasses.

param: string $gender
param: array $forms
return: string

convertPlural( $count, $forms )   X-Ref
Plural form transformations, needed for some languages.
For example, there are 3 form of plural in Russian and Polish,
depending on "count mod 10". See [[w:Plural]]
For English it is pretty simple.

Invoked by putting {{plural:count|wordform1|wordform2}}
or {{plural:count|wordform1|wordform2|wordform3}}

Example: {{plural:{{NUMBEROFARTICLES}}|article|articles}}

param: int $count Non-localized number
param: array $forms Different plural forms
return: string Correct form of plural for $count in this language

handleExplicitPluralForms( $count, array $forms )   X-Ref
Handles explicit plural forms for Language::convertPlural()

In {{PLURAL:$1|0=nothing|one|many}}, 0=nothing will be returned if $1 equals zero.
If an explicitly defined plural form matches the $count, then
string value returned, otherwise array returned for further consideration
by CLDR rules or overridden convertPlural().

param: int $count Non-localized number
param: array $forms Different plural forms
return: array|string

preConvertPlural( $forms, $count )   X-Ref
Checks that convertPlural was given an array and pads it to requested
amount of forms by copying the last one.

param: array $forms Array of forms given to convertPlural
param: int $count How many forms should there be at least
return: array Padded array of forms or an exception if not an array

translateBlockExpiry( $str )   X-Ref

param: string $str The validated block duration in English
return: string Somehow translated block duration

segmentForDiff( $text )   X-Ref
languages like Chinese need to be segmented in order for the diff
to be of any use

param: string $text
return: string

unsegmentForDiff( $text )   X-Ref
and unsegment to show the result

param: string $text
return: string

getConverter()   X-Ref
Return the LanguageConverter used in the Language

return: LanguageConverter

autoConvertToAllVariants( $text )   X-Ref
convert text to all supported variants

param: string $text
return: array

convert( $text )   X-Ref
convert text to different variants of a language.

param: string $text
return: string

convertTitle( $title )   X-Ref
Convert a Title object to a string in the preferred variant

param: Title $title
return: string

convertNamespace( $ns )   X-Ref
Convert a namespace index to a string in the preferred variant

param: int $ns
return: string

hasVariants()   X-Ref
Check if this is a language with variants

return: bool

hasVariant( $variant )   X-Ref
Check if the language has the specific variant

param: string $variant
return: bool

armourMath( $text )   X-Ref
Put custom tags (e.g. -{ }-) around math to prevent conversion

param: string $text
return: string

convertHtml( $text, $isTitle = false )   X-Ref
Perform output conversion on a string, and encode for safe HTML output.

param: string $text Text to be converted
param: bool $isTitle Whether this conversion is for the article title
return: string

convertCategoryKey( $key )   X-Ref

param: string $key
return: string

getVariants()   X-Ref
Get the list of variants supported by this language
see sample implementation in LanguageZh.php

return: array An array of language codes

getPreferredVariant()   X-Ref

return: string

getDefaultVariant()   X-Ref

return: string

getURLVariant()   X-Ref

return: string

findVariantLink( &$link, &$nt, $ignoreOtherCond = false )   X-Ref
If a language supports multiple variants, it is
possible that non-existing link in one variant
actually exists in another variant. this function
tries to find it. See e.g. LanguageZh.php
The input parameters may be modified upon return

param: string &$link The name of the link
param: Title &$nt The title object of the link
param: bool $ignoreOtherCond To disable other conditions when

getExtraHashOptions()   X-Ref
returns language specific options used by User::getPageRenderHash()
for example, the preferred language variant

return: string

getParsedTitle()   X-Ref
For languages that support multiple variants, the title of an
article may be displayed differently in different variants. this
function returns the apporiate title defined in the body of the article.

return: string

markNoConversion( $text, $noParse = false )   X-Ref
Prepare external link text for conversion. When the text is
a URL, it shouldn't be converted, and it'll be wrapped in
the "raw" tag (-{R| }-) to prevent conversion.

This function is called "markNoConversion" for historical
reasons.

param: string $text Text to be used for external link
param: bool $noParse Wrap it without confirming it's a real URL first
return: string The tagged text

linkTrail()   X-Ref
A regular expression to match legal word-trailing characters
which should be merged onto a link of the form [[foo]]bar.

return: string

linkPrefixCharset()   X-Ref
A regular expression character set to match legal word-prefixing
characters which should be merged onto a link of the form foo[[bar]].

return: string

getLangObj()   X-Ref

return: Language

getParentLanguage()   X-Ref
Get the "parent" language which has a converter to convert a "compatible" language
(in another variant) to this language (eg. zh for zh-cn, but not en for en-gb).

return: Language|null

getCode()   X-Ref
Get the RFC 3066 code for this language object

NOTE: The return value of this function is NOT HTML-safe and must be escaped with
htmlspecialchars() or similar

return: string

getHtmlCode()   X-Ref
Get the code in Bcp47 format which we can use
inside of html lang="" tags.

NOTE: The return value of this function is NOT HTML-safe and must be escaped with
htmlspecialchars() or similar.

return: string

setCode( $code )   X-Ref

param: string $code

getFileName( $prefix = 'Language', $code, $suffix = '.php' )   X-Ref
Get the name of a file for a certain language code

param: string $prefix Prepend this to the filename
param: string $code Language code
param: string $suffix Append this to the filename
return: string $prefix . $mangledCode . $suffix

getCodeFromFileName( $filename, $prefix = 'Language', $suffix = '.php' )   X-Ref
Get the language code from a file name. Inverse of getFileName()

param: string $filename $prefix . $languageCode . $suffix
param: string $prefix Prefix before the language code
param: string $suffix Suffix after the language code
return: string Language code, or false if $prefix or $suffix isn't found

getMessagesFileName( $code )   X-Ref

param: string $code
return: string

getJsonMessagesFileName( $code )   X-Ref

param: string $code
return: string

getClassFileName( $code )   X-Ref

param: string $code
return: string

getFallbackFor( $code )   X-Ref
Get the first fallback for a given language.

param: string $code
return: bool|string

getFallbacksFor( $code )   X-Ref
Get the ordered list of fallback languages.

param: string $code Language code
return: array

getFallbacksIncludingSiteLanguage( $code )   X-Ref
Get the ordered list of fallback languages, ending with the fallback
language chain for the site language.

param: string $code Language code
return: array Array( fallbacks, site fallbacks )

getMessagesFor( $code )   X-Ref
Get all messages for a given language
WARNING: this may take a long time. If you just need all message *keys*
but need the *contents* of only a few messages, consider using getMessageKeysFor().

param: string $code
return: array

getMessageFor( $key, $code )   X-Ref
Get a message for a given language

param: string $key
param: string $code
return: string

getMessageKeysFor( $code )   X-Ref
Get all message keys for a given language. This is a faster alternative to
array_keys( Language::getMessagesFor( $code ) )

param: string $code Language code
return: array Array of message keys (strings)

fixVariableInNamespace( $talk )   X-Ref

param: string $talk
return: mixed

replaceGrammarInNamespace( $m )   X-Ref

param: string $m
return: string

getCaseMaps()   X-Ref

return: array

formatExpiry( $expiry, $format = true )   X-Ref
Decode an expiry (block, protection, etc) which has come from the DB

param: string $expiry Database expiry String
param: bool|int $format True to process using language functions, or TS_ constant
return: string

formatTimePeriod( $seconds, $format = array()   X-Ref

param: int|float $seconds
param: array $format Optional
return: string

formatBitrate( $bps )   X-Ref
Format a bitrate for output, using an appropriate
unit (bps, kbps, Mbps, Gbps, Tbps, Pbps, Ebps, Zbps or Ybps) according to
the magnitude in question.

This use base 1000. For base 1024 use formatSize(), for another base
see formatComputingNumbers().

param: int $bps
return: string

formatComputingNumbers( $size, $boundary, $messageKey )   X-Ref

param: int $size Size of the unit
param: int $boundary Size boundary (1000, or 1024 in most cases)
param: string $messageKey Message key to be uesd
return: string

formatSize( $size )   X-Ref
Format a size in bytes for output, using an appropriate
unit (B, KB, MB, GB, TB, PB, EB, ZB or YB) according to the magnitude in question

This method use base 1024. For base 1000 use formatBitrate(), for
another base see formatComputingNumbers()

param: int $size Size to format
return: string Plain text (not HTML)

specialList( $page, $details, $oppositedm = true )   X-Ref
Make a list item, used by various special pages

param: string $page Page link
param: string $details Text between brackets
param: bool $oppositedm Add the direction mark opposite to your
return: string

viewPrevNext( Title $title, $offset, $limit,array $query = array()   X-Ref
Generate (prev x| next x) (20|50|100...) type links for paging

param: Title $title Title object to link
param: int $offset
param: int $limit
param: array $query Optional URL query parameter string
param: bool $atend Optional param for specified if this is the last page
return: string

numLink( Title $title, $offset, $limit, array $query, $link,$tooltipMsg, $class)   X-Ref
Helper function for viewPrevNext() that generates links

param: Title $title Title object to link
param: int $offset
param: int $limit
param: array $query Extra query parameters
param: string $link Text to use for the link; will be escaped
param: string $tooltipMsg Name of the message to use as tooltip
param: string $class Value of the "class" attribute of the link
return: string HTML fragment

getConvRuleTitle()   X-Ref
Get the conversion rule title, if any.

return: string

getCompiledPluralRules()   X-Ref
Get the compiled plural rules for the language

return: array Associative array with plural form, and plural rule as key-value pairs

getPluralRules()   X-Ref
Get the plural rules for the language

return: array Associative array with plural form number and plural rule as key-value pairs

getPluralRuleTypes()   X-Ref
Get the plural rule types for the language

return: array Associative array with plural form number and plural rule type as key-value pairs

getPluralRuleIndexNumber( $number )   X-Ref
Find the index number of the plural rule appropriate for the given number

param: int $number
return: int The index number of the plural rule

getPluralRuleType( $number )   X-Ref
Find the plural rule type appropriate for the given number
For example, if the language is set to Arabic, getPluralType(5) should
return 'few'.

param: int $number
return: string The name of the plural rule type, e.g. one, two, few, many



Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1