MediaWiki REL1_39
Language Class Reference

Base class for language-specific code. More...

Inheritance diagram for Language:

Public Member Functions

 __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.
 
 autoConvert ( $text, $variant=false)
 convert text to a variant
 
 autoConvertToAllVariants ( $text)
 convert text to all supported variants
 
 caseFold ( $s)
 Return a case-folded representation of $s.
 
 checkTitleEncoding ( $s)
 TODO: $s is not always a string per T218883.
 
 commafy ( $number)
 Adds commas to a given number.
 
 commaList (array $list)
 Take a list of strings and build a locale-friendly comma-separated list, using the local comma-separator message.
 
 convert ( $text)
 convert text to different variants of a language.
 
 convertCategoryKey ( $key)
 
 convertForSearchResult ( $termsArray)
 
 convertGrammar ( $word, $case)
 Grammatical transformations, needed for inflected languages Invoked by putting {{grammar:case|word}} in a message.
 
 convertHtml ( $text)
 Perform output conversion on a string, and encode for safe HTML output.
 
 convertNamespace ( $ns, $variant=null)
 Convert a namespace index to a string in the preferred variant.
 
 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, it should be used in all children.
 
 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 an other 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)
 
 formatDuration ( $seconds, array $chosenIntervals=[])
 Takes a number of seconds and turns it 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, $noSeparators=null)
 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.
 
 getConverter ()
 Return the LanguageConverter used in the Language.
 
 getConvRuleTitle ()
 Get the conversion rule title, if any.
 
 getDateFormats ()
 
 getDateFormatString ( $type, $pref)
 Get a format string for a given type and preference.
 
 getDatePreferenceMigrationMap ()
 
 getDatePreferences ()
 
 getDefaultDateFormat ()
 
 getDefaultVariant ()
 
 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.
 
 getExtraHashOptions ()
 returns language specific options used by User::getPageRenderHash() for example, the preferred language variant
 
 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 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 of 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".
 
 getLocalNsIndex ( $text)
 Get a namespace key by value, case insensitive.
 
 getMagic ( $mw)
 Fill a MagicWord object with data from here.
 
 getMagicWords ()
 Get all magic words from 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 value, case insensitive.
 
 getNsText ( $index)
 Get a namespace value by key.
 
 getParentLanguage ()
 Get the "parent" language which has a converter to convert a "compatible" language (in another variant) to this language (eg.
 
 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 For example, if the language is set to Arabic, getPluralType(5) should return 'few'.
 
 getPluralRuleTypes ()
 Get the plural rule types for the language.
 
 getPreferredVariant ()
 
 getSpecialPageAliases ()
 Get special page names, as an associative array canonical name => array of valid names, including aliases.
 
 getURLVariant ()
 
 getVariantname ( $code, $usemsg=true)
 short names for language variants used for language conversion links.
 
 getVariants ()
 Get the list of variants supported by this language see sample implementation in LanguageZh.php.
 
 getWeekdayAbbreviation ( $key)
 
 getWeekdayName ( $key)
 
 hasVariant ( $variant)
 Strict check if the language has the specific variant.
 
 hasVariants ()
 Check if this is a language with variants.
 
 hasWordBreaks ()
 Most writing systems use whitespace to break up words.
 
 iconv ( $in, $out, $string)
 
 isRTL ()
 For right-to-left language support.
 
 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 ()
 
 needsGenderDistinction ()
 Whether this language uses gender-dependent namespace aliases.
 
 normalize ( $s)
 Convert a UTF-8 string to normal form C.
 
 normalizeForSearch ( $string)
 Some languages have special punctuation need to be normalized.
 
 parseFormattedNumber ( $number)
 
 pipeList (array $list)
 Same as commaList, but separate it with the pipe instead.
 
 resetNamespaces ()
 Resets all of the namespace caches.
 
 segmentByWord ( $string)
 Some languages such as Chinese require word segmentation, Specify such segmentation when overridden in derived class.
 
 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 of 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)
 
 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.
 
 truncateForVisual ( $string, $length, $ellipsis='...', $adjustLength=true)
 Truncate a string to a specified number of characters, appending an optional string (e.g.
 
 truncateHtml ( $text, $length, $ellipsis='...')
 Truncate a string of valid HTML to a specified length in bytes, appending an optional string (e.g.
 
 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.
 

Static Public Member Functions

static factory ( $code)
 Get a cached or new language object for a given language code.
 
static fetchLanguageName ( $code, $inLanguage=LanguageNameUtils::AUTONYMS, $include=LanguageNameUtils::ALL)
 
static fetchLanguageNames ( $inLanguage=LanguageNameUtils::AUTONYMS, $include=LanguageNameUtils::DEFINED)
 Get an array of language names, indexed by code.
 
static getCodeFromFileName ( $filename, $prefix='Language', $suffix='.php')
 Get the language code from a file name.
 
static getFallbackFor ( $code)
 Get the first fallback for a given language.
 
static getFallbacksFor ( $code, $mode=LanguageFallback::MESSAGES)
 Get the ordered list of fallback languages.
 
static getFallbacksIncludingSiteLanguage ( $code)
 Get the ordered list of fallback languages, ending with the fallback language chain for the site language.
 
static getFileName ( $prefix, $code, $suffix='.php')
 Get the name of a file for a certain language code.
 
static getJsonMessagesFileName ( $code)
 
static getLocalisationCache ()
 
static getMessageFor ( $key, $code)
 Get a message for a given language.
 
static getMessageKeysFor ( $code)
 Get all message keys for a given language.
 
static getMessagesFileName ( $code)
 
static getMessagesFor ( $code)
 Get all messages for a given language WARNING: this may take a long time.
 
static hebrewNumeral ( $num)
 Hebrew Gematria number formatting up to 9999.
 
static isKnownLanguageTag ( $tag)
 Returns true if a language code is an IETF tag known to MediaWiki.
 
static isSupportedLanguage ( $code)
 Checks whether any localisation is available for that language tag in MediaWiki (MessagesXx.php exists).
 
static isValidBuiltInCode ( $code)
 Returns true if a language code is of a valid form for the purposes of internal customisation of MediaWiki, via Messages*.php or *.json.
 
static isValidCode ( $code)
 Returns true if a language code string is of a valid form, whether or not it exists.
 
static isWellFormedLanguageTag ( $code, $lenient=false)
 Returns true if a language code string is a well-formed language tag according to RFC 5646.
 
static romanNumeral ( $num)
 Roman number formatting up to 10000.
 

Public Attributes

string[][] $dateFormatStrings = []
 memoize
 
string $mCode
 
string[][] null $mExtendedSpecialPageAliases
 memoize
 
 $mMagicExtensions = []
 
const ALL = LanguageNameUtils::ALL
 Return all known languages in fetchLanguageName(s).
 
const HEBREW_CALENDAR_MONTH_GENITIVE_MESSAGES
 
const HEBREW_CALENDAR_MONTHS_MESSAGES
 
const HIJRI_CALENDAR_MONTH_MESSAGES
 
const IRANIAN_CALENDAR_MONTHS_MESSAGES
 
const MESSAGES_FALLBACKS = LanguageFallback::MESSAGES
 Return a fallback chain for messages in getFallbacksFor.
 
const MONTH_ABBREVIATED_MESSAGES
 
const MONTH_GENITIVE_MESSAGES
 
const MONTH_MESSAGES
 
const STRICT_FALLBACKS = LanguageFallback::STRICT
 Return a strict fallback chain in getFallbacksFor.
 
const SUPPORTED = LanguageNameUtils::SUPPORTED
 Return in fetchLanguageName(s) only the languages for which we have at least some localisation.
 
const WEEKDAY_ABBREVIATED_MESSAGES
 
const WEEKDAY_MESSAGES
 

Static Public Attributes

static int[] $durationIntervals = self::DURATION_INTERVALS
 
static $mMonthAbbrevMsgs = self::MONTH_ABBREVIATED_MESSAGES
 
static $mMonthMsgs = self::MONTH_MESSAGES
 

Protected Member Functions

 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()
 
 mbUpperChar ( $char)
 Convert character to uppercase, allowing overrides of the default mb_upper behaviour, which is buggy in many ways.
 
 msg ( $msg,... $params)
 Get message object in this language.
 
 preConvertPlural ($forms, $count)
 Checks that convertPlural was given an array and pads it to requested amount of forms by copying the last one.
 
 removeBadCharFirst ( $string)
 Remove bytes that represent an incomplete Unicode character at the start of string (e.g.
 
 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

static convertDoubleWidth ( $string)
 convert double-width roman characters to single-width.
 
static insertSpace ( $string, $pattern)
 

Protected Attributes

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

Base class for language-specific code.

See https://www.mediawiki.org/wiki/Special:MyLanguage/Localisation for more information.

Definition at line 53 of file Language.php.

Constructor & Destructor Documentation

◆ __construct()

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 )
Access: internal
Calling this directly is deprecated. Use LanguageFactory instead.
Parameters
string | null$codeWhich code to use. Passing null is deprecated in 1.35.
NamespaceInfo | null$namespaceInfo
LocalisationCache | null$localisationCache
LanguageNameUtils | null$langNameUtils
LanguageFallback | null$langFallback
LanguageConverterFactory | null$converterFactory
HookContainer | null$hookContainer
Config | null$config

Definition at line 403 of file Language.php.

Member Function Documentation

◆ alignEnd()

Language::alignEnd ( )

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....

Returns
string

Definition at line 3025 of file Language.php.

◆ alignStart()

Language::alignStart ( )

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....

Returns
string

Definition at line 3013 of file Language.php.

◆ autoConvert()

Language::autoConvert ( $text,
$variant = false )

convert text to a variant

Deprecated
since 1.35 use LanguageConverter::autoConvert
Parameters
string$texttext to convert
string | false$variantvariant to convert to, or false to use the user's preferred variant (if logged in), or the project default variant
Returns
string the converted string

Definition at line 4150 of file Language.php.

◆ autoConvertToAllVariants()

Language::autoConvertToAllVariants ( $text)

convert text to all supported variants

Deprecated
since 1.35 use LanguageConverter::autoConvertToAllVariants
Parameters
string$text
Returns
array

Definition at line 4162 of file Language.php.

Referenced by LanguageZh\convertForSearchResult().

◆ caseFold()

Language::caseFold ( $s)

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.

Parameters
string$s
Returns
string

Definition at line 2794 of file Language.php.

References $s.

◆ checkTitleEncoding()

Language::checkTitleEncoding ( $s)

TODO: $s is not always a string per T218883.

Parameters
string$s
Returns
string

Definition at line 2803 of file Language.php.

References $s, and StringUtils\isUtf8().

◆ commafy()

Language::commafy ( $number)

Adds commas to a given number.

NumberFormatting class is used when available for correct implementation as per tr35 specification of unicode.

Since
1.19
Deprecated
in 1.36 use formatNum
Parameters
string | null$numberExpected to be a numeric string without (thousand) group separators. Decimal separator, if present, must be a dot. Any non-string will be cast to string.
Returns
string

Definition at line 3391 of file Language.php.

References wfDeprecated().

◆ commaList()

Language::commaList ( array $list)

Take a list of strings and build a locale-friendly comma-separated list, using the local comma-separator message.

Parameters
string[]$listArray of strings to put in a comma list
Returns
string

Definition at line 3461 of file Language.php.

References wfMessage().

◆ convert()

Language::convert ( $text)

convert text to different variants of a language.

Warning
Glossary state is maintained between calls. This means if you pass unescaped text to this method it can cause an XSS in later calls to this method, even if the later calls have properly escaped the input. Never feed this method user controlled text that is not properly escaped!
Deprecated
since 1.35 use LanguageConverter::convert
Parameters
string$textContent that has been already escaped for use in HTML
Returns
string HTML

Definition at line 4180 of file Language.php.

◆ convertCategoryKey()

Language::convertCategoryKey ( $key)
Deprecated
since 1.35 use LanguageConverter::convertCategoryKey instead
Parameters
string$key
Returns
string

Definition at line 4244 of file Language.php.

◆ convertDoubleWidth()

static Language::convertDoubleWidth ( $string)
staticprotected

convert double-width roman characters to single-width.

range: ff00-ff5f ~= 0020-007f

Parameters
string$string
Returns
string

Definition at line 2863 of file Language.php.

Referenced by LanguageZh\convertForSearchResult(), and LanguageYue\normalizeForSearch().

◆ convertForSearchResult()

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

Reimplemented in LanguageZh.

Definition at line 2893 of file Language.php.

◆ convertGrammar()

Language::convertGrammar ( $word,
$case )

Grammatical transformations, needed for inflected languages Invoked by putting {{grammar:case|word}} in a message.

Parameters
string$word
string$case
Returns
string

Reimplemented in LanguageBs, LanguageCu, LanguageDsb, LanguageFi, LanguageGa, LanguageHsb, LanguageHu, LanguageHy, LanguageKaa, LanguageKk, LanguageKsh, LanguageLa, LanguageOs, LanguageSl, and LanguageTyv.

Definition at line 3835 of file Language.php.

References wfLogWarning().

◆ convertHtml()

Language::convertHtml ( $text)

Perform output conversion on a string, and encode for safe HTML output.

Deprecated
since 1.35 use LanguageConverter::convertHtml instead
Parameters
string$textText to be converted
Returns
string
Todo
this should get integrated somewhere sensible

Definition at line 4234 of file Language.php.

◆ convertNamespace()

Language::convertNamespace ( $ns,
$variant = null )

Convert a namespace index to a string in the preferred variant.

Deprecated
since 1.35 use LanguageConverter::convertNamespace instead
Parameters
int$nsnamespace index (https://www.mediawiki.org/wiki/Manual:Namespace)
string | null$variantvariant to convert to, or null to use the user's preferred variant (if logged in), or the project default variant
Returns
string a string representation of the namespace

Definition at line 4194 of file Language.php.

◆ convertPlural()

Language::convertPlural ( $count,
$forms )

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}}

Parameters
int$countNon-localized number
array$formsDifferent plural forms
Returns
string Correct form of plural for $count in this language

Reimplemented in LanguageKsh.

Definition at line 3972 of file Language.php.

◆ date()

Language::date ( $ts,
$adj = false,
$format = true,
$timecorrection = false )
Parameters
string$tsThe time format which needs to be turned into a date('YmdHis') format with wfTimestamp(TS_MW,$ts)
bool$adjWhether to adjust the time output according to the user configured offset ($timecorrection)
mixed$formatTrue to use user's date format preference
string | false$timecorrectionThe time offset as returned by validateTimeZone() in Special:Preferences
Returns
string

Reimplemented in LanguageWa.

Definition at line 2205 of file Language.php.

References wfTimestamp().

Referenced by LanguageFi\translateBlockExpiry().

◆ dateFormat()

Language::dateFormat ( $usePrefs = true)

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.

function timeanddate([...], $format = true) {
  $datePreference = $this->dateFormat($format);
  [...]
}
Parameters
int | string | bool$usePrefsIf true, the user's preference is used if false, the site/language default is used if int/string, assumed to be a format.
Returns
string

Definition at line 2137 of file Language.php.

Referenced by LanguageWa\date(), and LanguageWa\timeanddate().

◆ digitGroupingPattern()

Language::digitGroupingPattern ( )
Returns
string

Definition at line 3403 of file Language.php.

◆ digitTransformTable()

Language::digitTransformTable ( )
Returns
string[]

Definition at line 3410 of file Language.php.

◆ embedBidi()

Language::embedBidi ( $text = '')

Wraps argument with unicode control characters for directionality safety.

This solves the problem where directionality-neutral characters at the edge of the argument string get interpreted with the wrong directionality from the enclosing context, giving renderings that look corrupted like "(Ben_(WMF".

The wrapping is LRE...PDF or RLE...PDF, depending on the detected directionality of the argument string, using the BIDI algorithm's own "First strong directional codepoint" rule. Essentially, this works round the fact that there is no embedding equivalent of U+2068 FSI (isolation with heuristic direction inference). The latter is cleaner but still not widely supported.

Parameters
string$textText to wrap
Returns
string Text, wrapped in LRE...PDF or RLE...PDF or nothing

Definition at line 4043 of file Language.php.

◆ emphasize()

Language::emphasize ( $text)

Italic is unsuitable for some languages.

Parameters
string$textThe text to be emphasized.
Returns
string

Reimplemented in LanguageJa.

Definition at line 3146 of file Language.php.

◆ equals()

Language::equals ( Language $lang)

Compare with an other language object.

Since
1.28
Parameters
Language$lang
Returns
bool

Definition at line 4336 of file Language.php.

References $lang.

◆ factory()

static Language::factory ( $code)
static

Get a cached or new language object for a given language code.

Deprecated
since 1.35, use LanguageFactory
Parameters
string$code
Exceptions
MWExceptionif the language code is invalid
Returns
Language

Definition at line 298 of file Language.php.

◆ fallback8bitEncoding()

Language::fallback8bitEncoding ( )
Returns
string

Definition at line 2817 of file Language.php.

◆ fetchLanguageName()

static Language::fetchLanguageName ( $code,
$inLanguage = LanguageNameUtils::AUTONYMS,
$include = LanguageNameUtils::ALL )
static
Deprecated
since 1.34, use LanguageNameUtils::getLanguageName
Parameters
string$codeThe code of the language for which to get the name
null | string$inLanguageCode of language in which to return the name (LanguageNameUtils::AUTONYMS for autonyms)
string$includeSee fetchLanguageNames()
Returns
string Language name or empty
Since
1.20

Definition at line 826 of file Language.php.

◆ fetchLanguageNames()

static Language::fetchLanguageNames ( $inLanguage = LanguageNameUtils::AUTONYMS,
$include = LanguageNameUtils::DEFINED )
static

Get an array of language names, indexed by code.

Deprecated
since 1.34, use LanguageNameUtils::getLanguageNames
Parameters
null | string$inLanguageCode of language in which to return the names Use LanguageNameUtils::AUTONYMS for autonyms (native names)
string$includeOne of: LanguageNameUtils::AUTONYMS all available languages LanguageNameUtils::DEFINED only if the language is defined in MediaWiki or wgExtraLanguageNames (default) LanguageNameUtils::SUPPORTED only if the language is in LanguageNameUtils::DEFINED and has a message file
Returns
string[] Language code => language name (sorted by key)
Since
1.20

Definition at line 809 of file Language.php.

◆ firstChar()

Language::firstChar ( $s)

Get the first character of a string.

Parameters
string$s
Returns
string

Definition at line 2905 of file Language.php.

References $s.

◆ formatBitrate()

Language::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.

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

Parameters
int$bps
Returns
string

Definition at line 4688 of file Language.php.

◆ formatComputingNumbers()

Language::formatComputingNumbers ( $size,
$boundary,
$messageKey )
Parameters
int$sizeSize of the unit
int$boundarySize boundary (1000, or 1024 in most cases)
string$messageKeyMessage key to be used
Returns
string

Definition at line 4701 of file Language.php.

◆ formatDuration()

Language::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 amount of seconds.
array$chosenIntervalsThe intervals to enable.
Returns
string

Reimplemented in LanguageZh_hans.

Definition at line 2263 of file Language.php.

References wfMessage().

◆ formatExpiry()

Language::formatExpiry ( $expiry,
$format = true,
$infinity = 'infinity',
$user = null )

Decode an expiry (block, protection, etc) which has come from the DB.

Parameters
string$expiryDatabase expiry String
true | int$formatTrue to process using language functions, or TS_ constant to return the expiry in a given timestamp
string$infinityIf $format is not true, use this string for infinite expiry
UserIdentity | null$userIf $format is true, use this user for date format
Returns
string
Since
1.18
1.36 $user was added

Definition at line 4547 of file Language.php.

References DB_REPLICA, wfGetDB(), and wfTimestamp().

◆ formatNum()

Language::formatNum ( $number,
$noSeparators = null )

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.

However this is not suitable for all languages, some such as Bengali (bn) 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: wfMessage( 'message' )->numParams( $num )->text()

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

Parameters
string | int | float$numberExpected to be a pre-formatted (e.g. leading zeros, number of decimal places) numeric string. Any non-string will be cast to string.
bool | null$noSeparatorsSet to true for special numbers like dates (deprecated: use ::formatNumNoSeparators instead of this param)
Returns
string

Reimplemented in LanguageKm, and LanguageMy.

Definition at line 3172 of file Language.php.

References wfDeprecated().

◆ formatNumNoSeparators()

Language::formatNumNoSeparators ( $number)

Front-end for non-commafied formatNum.

Parameters
string | int | float$numberThe string to be formatted, should be an integer or a floating point number.
Since
1.21
Returns
string

Definition at line 3340 of file Language.php.

Referenced by LanguageKm\formatNum(), and LanguageMy\formatNum().

◆ formatSize()

Language::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.

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

Parameters
int$sizeSize to format
Returns
string Plain text (not HTML)

Definition at line 4739 of file Language.php.

◆ formatTimePeriod()

Language::formatTimePeriod ( $seconds,
$format = [] )

Formats a time given in seconds into a string representation of that time.

Parameters
int | float$seconds
array$formatAn optional argument that formats the returned string in different ways: If $format['avoid'] === 'avoidhours': don't show hours, just show days If $format['avoid'] === 'avoidseconds': don't show seconds if $seconds >= 1 hour, If $format['avoid'] === 'avoidminutes': don't show seconds/minutes if $seconds > 48 hours, If $format['noabbrevs'] is true: use 'seconds' and friends instead of 'seconds-abbrev' and friends.
Note
For backwards compatibility, $format may also be one of the strings 'avoidseconds' or 'avoidminutes'.
Returns
string

Definition at line 4581 of file Language.php.

References $s, and wfMessage().

◆ gender()

Language::gender ( $gender,
$forms )

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.

Parameters
string$gender
array$forms
Returns
string

Definition at line 3943 of file Language.php.

◆ getAllMessages()

Language::getAllMessages ( )
Returns
string[]

Definition at line 2601 of file Language.php.

◆ getArrow()

Language::getArrow ( $direction = 'forwards')

An arrow, depending on the language direction.

Parameters
string$directionThe direction of the arrow: forwards (default), backwards, left, right, up, down.
Returns
string

Definition at line 3073 of file Language.php.

◆ getBookstoreList()

Language::getBookstoreList ( )

Exports $wgBookstoreListEn.

Returns
array

Definition at line 473 of file Language.php.

◆ getCode()

Language::getCode ( )

Get the internal language code for this language object.

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

Returns
string

Definition at line 4348 of file Language.php.

Referenced by AllMessagesTablePager\__construct(), MessageCache\__construct(), LanguageHu\convertGrammar(), and Message\inLanguage().

◆ getCodeFromFileName()

static Language::getCodeFromFileName ( $filename,
$prefix = 'Language',
$suffix = '.php' )
static

Get the language code from a file name.

Inverse of getFileName()

Parameters
string$filename$prefix . $languageCode . $suffix
string$prefixPrefix before the language code
string$suffixSuffix after the language code
Returns
string|false Language code, or false if $prefix or $suffix isn't found

Definition at line 4376 of file Language.php.

◆ getCompiledPluralRules()

Language::getCompiledPluralRules ( )

Get the compiled plural rules for the language.

Since
1.20
Returns
array Associative array with plural form, and plural rule as key-value pairs

Definition at line 4782 of file Language.php.

◆ getConverter()

Language::getConverter ( )

Return the LanguageConverter used in the Language.

Since
1.19
Deprecated
since 1.35 Use MediaWikiServices::getInstance()->getLanguageConverterFactory() ->getLanguageConverter( $language ) instead
Returns
ILanguageConverter

Definition at line 4136 of file Language.php.

Referenced by LanguageZh\convertForSearchResult(), getNamespaceAliases(), and LanguageZh\normalizeForSearch().

◆ getConvRuleTitle()

Language::getConvRuleTitle ( )

Get the conversion rule title, if any.

Deprecated
since 1.35 use LanguageConverter::getConvRuleTitle instead
Returns
string|false

Definition at line 4773 of file Language.php.

◆ getDateFormats()

Language::getDateFormats ( )
Returns
string[]

Definition at line 771 of file Language.php.

◆ getDateFormatString()

Language::getDateFormatString ( $type,
$pref )

Get a format string for a given type and preference.

Parameters
string$typeMay be 'date', 'time', 'both', or 'pretty'.
string$prefThe format name as it appears in Messages*.php under $datePreferences.
Since
1.22 New type 'pretty' that provides a more readable timestamp format
Returns
string

Definition at line 2169 of file Language.php.

References $type.

◆ getDatePreferenceMigrationMap()

Language::getDatePreferenceMigrationMap ( )
Returns
string[]

Definition at line 790 of file Language.php.

◆ getDatePreferences()

Language::getDatePreferences ( )
Returns
string[]|false List of date format preference keys, or false if disabled.

Definition at line 764 of file Language.php.

◆ getDefaultDateFormat()

Language::getDefaultDateFormat ( )
Returns
string

Definition at line 778 of file Language.php.

◆ getDefaultVariant()

Language::getDefaultVariant ( )
Deprecated
since 1.35 use LanguageConverter::getDefaultVariant instead
Returns
string

Definition at line 4272 of file Language.php.

◆ getDir()

Language::getDir ( )

Return the correct HTML 'dir' attribute value for this language.

Returns
string

Definition at line 3001 of file Language.php.

◆ getDirMark()

Language::getDirMark ( $opposite = false)

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.

Parameters
bool$oppositeGet the direction mark opposite to your language
Returns
string

Definition at line 3057 of file Language.php.

◆ getDirMarkEntity()

Language::getDirMarkEntity ( $opposite = false)

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.

Parameters
bool$oppositeGet the direction mark opposite to your language
Returns
string
Since
1.20

Definition at line 3040 of file Language.php.

◆ getDurationIntervals()

Language::getDurationIntervals ( $seconds,
array $chosenIntervals = [] )

Takes a number of seconds and returns an array with a set of corresponding intervals.

For example 65 will be turned into [ minutes => 1, seconds => 5 ].

Since
1.20
Parameters
int$secondsThe amount of seconds.
array$chosenIntervalsThe intervals to enable.
Returns
int[]

Definition at line 2289 of file Language.php.

Referenced by LanguageZh_hans\formatDuration().

◆ getExtraHashOptions()

Language::getExtraHashOptions ( )

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

Deprecated
since 1.35 use LanguageConverter::getExtraHashOptions instead
Returns
string

Definition at line 4292 of file Language.php.

◆ getFallbackFor()

static Language::getFallbackFor ( $code)
static

Get the first fallback for a given language.

Deprecated
since 1.35, use LanguageFallback::getFirst
Parameters
string$code
Returns
string|false False if no fallbacks

Definition at line 4431 of file Language.php.

◆ getFallbackLanguages()

Language::getFallbackLanguages ( )
Returns
array
Since
1.19

Definition at line 465 of file Language.php.

◆ getFallbacksFor()

static Language::getFallbacksFor ( $code,
$mode = LanguageFallback::MESSAGES )
static

Get the ordered list of fallback languages.

Deprecated
since 1.35, use LanguageFallback::getAll
Since
1.19
Parameters
string$codeLanguage code
int$modeFallback mode, either MESSAGES_FALLBACKS (which always falls back to 'en'), or STRICT_FALLBACKS (which only falls back to 'en' when explicitly defined)
Exceptions
InvalidArgumentException
Returns
string[] List of language codes

Definition at line 4448 of file Language.php.

◆ getFallbacksIncludingSiteLanguage()

static Language::getFallbacksIncludingSiteLanguage ( $code)
static

Get the ordered list of fallback languages, ending with the fallback language chain for the site language.

Deprecated
since 1.35, use LanguageFallback::getAllIncludingSiteLanguage
Since
1.22
Parameters
string$codeLanguage code
Returns
string[][] [ fallbacks, site fallbacks ]

Definition at line 4462 of file Language.php.

◆ getFileName()

static Language::getFileName ( $prefix,
$code,
$suffix = '.php' )
static

Get the name of a file for a certain language code.

Deprecated
since 1.34, use LanguageNameUtils
Parameters
string$prefixPrepend this to the filename
string$codeLanguage code
string$suffixAppend this to the filename
Exceptions
MWException
Returns
string $prefix . $mangledCode . $suffix

Definition at line 4396 of file Language.php.

◆ getFormattedNamespaces()

Language::getFormattedNamespaces ( )

A convenience function that returns getNamespaces() with spaces instead of underscores in values.

Useful for producing output to be displayed e.g. in <select> forms.

Returns
string[]

Definition at line 547 of file Language.php.

References getNamespaces().

◆ getFormattedNsText()

Language::getFormattedNsText ( $index)

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

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

Parameters
int$indexThe array key of the namespace to return
Returns
string Namespace name without underscores (empty string if namespace does not exist)

Definition at line 586 of file Language.php.

References getNsText().

◆ getGenderNsText()

Language::getGenderNsText ( $index,
$gender )

Returns gender-dependent namespace alias if available.

See https://www.mediawiki.org/wiki/Manual:$wgExtraGenderNamespaces

Parameters
int$indexNamespace index
string$genderGender key (male, female... )
Returns
string|false
Since
1.18

Definition at line 599 of file Language.php.

References getNsText().

◆ getGrammarForms()

Language::getGrammarForms ( )

Get the grammar forms for the content language.

Returns
array Array of grammar forms
Since
1.20

Definition at line 3886 of file Language.php.

◆ getGrammarTransformations()

Language::getGrammarTransformations ( )

Get the grammar transformations data for the language.

Used like grammar forms, with {{GRAMMAR}} and cases, but uses pairs of regexes and replacements instead of code.

Returns
array[] Array of grammar transformations.
Exceptions
MWException
Since
1.28

Definition at line 3906 of file Language.php.

References $IP.

◆ getGroupMemberName()

Language::getGroupMemberName ( string $group,
$member )

Gets the localized name for a member of a group, if it exists.

For example, "administrator" or "bureaucrat"

Parameters
string$groupInternal group name
string | UserIdentity$member
Returns
string Localized name for group member

Definition at line 2582 of file Language.php.

◆ getGroupName()

Language::getGroupName ( $group)

Gets the localized friendly name for a group, if it exists.

For example, "Administrators" or "Bureaucrats"

Parameters
string$groupInternal group name
Returns
string Localized friendly group name

Definition at line 2569 of file Language.php.

◆ getHookContainer()

Language::getHookContainer ( )
protected

Get a HookContainer, for hook metadata and running extension hooks.

Since
1.35
Returns
HookContainer

Definition at line 4871 of file Language.php.

◆ getHookRunner()

Language::getHookRunner ( )
protected

Get a HookRunner, for running core hooks.

Access: internal
This is for use by core only. Hook interfaces may be removed without notice.
Since
1.35
Returns
HookRunner

Definition at line 4883 of file Language.php.

Referenced by getNamespaces().

◆ getHtmlCode()

Language::getHtmlCode ( )

Get the code in BCP 47 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.

Since
1.19
Returns
string

Definition at line 4362 of file Language.php.

◆ getHumanTimestamp()

Language::getHumanTimestamp ( MWTimestamp $time,
MWTimestamp $relativeTo = null,
UserIdentity $user = null )

Get the timestamp in a human-friendly relative format, e.g., "3 days ago".

Determine the difference between the timestamp and the current time, and generate a readable timestamp by returning "<N> <units> ago", where the largest possible unit is used.

Since
1.26 (Prior to 1.26 method existed but was not meant to be used directly)
Parameters
MWTimestamp$time
MWTimestamp | null$relativeToThe base timestamp to compare to (defaults to now)
UserIdentity | null$userUser the timestamp is being generated for (or null to use main context's user)
Returns
string Formatted timestamp

Definition at line 2450 of file Language.php.

References MWTimestamp\offsetForUser().

◆ getJsonMessagesFileName()

static Language::getJsonMessagesFileName ( $code)
static
Deprecated
since 1.34, use LanguageNameUtils
Parameters
string$code
Returns
string
Exceptions
MWException
Since
1.23

Definition at line 4418 of file Language.php.

◆ getLocalisationCache()

static Language::getLocalisationCache ( )
static
Deprecated
since 1.34, use MediaWikiServices
Returns
LocalisationCache

Definition at line 387 of file Language.php.

◆ getLocalNsIndex()

Language::getLocalNsIndex ( $text)

Get a namespace key by value, case insensitive.

Only matches namespace names for the current language, not the canonical ones defined in Namespace.php.

Parameters
string$text
Returns
int|false An integer if $text is a valid value otherwise false

Definition at line 639 of file Language.php.

References getNamespaceIds(), and lc().

◆ getMagic()

Language::getMagic ( $mw)

Fill a MagicWord object with data from here.

Parameters
MagicWord$mw

Definition at line 3112 of file Language.php.

References wfWarn().

◆ getMagicWords()

Language::getMagicWords ( )

Get all magic words from cache.

Returns
string[][]

Definition at line 3103 of file Language.php.

◆ getMessage()

Language::getMessage ( $key)
Parameters
string$key
Returns
string|null

Reimplemented in LanguageQqx.

Definition at line 2594 of file Language.php.

◆ getMessageFor()

static Language::getMessageFor ( $key,
$code )
static

Get a message for a given language.

Deprecated
since 1.35, use LocalisationCache directly
Parameters
string$key
string$code
Returns
string

Definition at line 4492 of file Language.php.

◆ getMessageFromDB()

Language::getMessageFromDB ( $msg)

Get a message from the MediaWiki namespace.

Parameters
string$msgMessage name
Returns
string

Definition at line 841 of file Language.php.

Referenced by getVariantname().

◆ getMessageKeysFor()

static Language::getMessageKeysFor ( $code)
static

Get all message keys for a given language.

This is a faster alternative to array_keys( Language::getMessagesFor( $code ) )

Deprecated
since 1.35, use LocalisationCache directly
Since
1.19
Parameters
string$codeLanguage code
Returns
string[] Array of message keys (strings)

Definition at line 4506 of file Language.php.

◆ getMessagesFileName()

static Language::getMessagesFileName ( $code)
static
Deprecated
since 1.34, use LanguageNameUtils
Parameters
string$code
Returns
string

Definition at line 4406 of file Language.php.

◆ getMessagesFor()

static Language::getMessagesFor ( $code)
static

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().

Deprecated
since 1.35, use LocalisationCache directly
Parameters
string$code
Returns
array

Definition at line 4478 of file Language.php.

◆ getMonthAbbreviation()

Language::getMonthAbbreviation ( $key)
Parameters
int$keyNumber from 1 to 12
Returns
string

Definition at line 887 of file Language.php.

◆ getMonthAbbreviationsArray()

Language::getMonthAbbreviationsArray ( )
Returns
string[] Indexed from 0 to 11

Definition at line 894 of file Language.php.

◆ getMonthName()

Language::getMonthName ( $key)
Parameters
int$keyNumber from 1 to 12
Returns
string

Definition at line 860 of file Language.php.

Referenced by LanguageWa\date().

◆ getMonthNameGen()

Language::getMonthNameGen ( $key)
Parameters
int$keyNumber from 1 to 12
Returns
string

Definition at line 879 of file Language.php.

◆ getMonthNamesArray()

Language::getMonthNamesArray ( )
Returns
string[] Indexed from 0 to 11

Definition at line 867 of file Language.php.

◆ getNamespaceAliases()

Language::getNamespaceAliases ( )
Returns
array<string,int> Map from names to namespace IDs. Note that each namespace ID can have multiple alias.

Definition at line 649 of file Language.php.

References $namespaceAliases, getConverter(), getNamespaces(), getVariants(), and NS_PROJECT_TALK.

Referenced by getNamespaceIds().

◆ getNamespaceIds()

Language::getNamespaceIds ( )
Returns
array<string,int> indexed by localized lower-cased namespace name

Definition at line 706 of file Language.php.

References getNamespaceAliases(), getNamespaces(), and lc().

Referenced by getLocalNsIndex(), and getNsIndex().

◆ getNamespaces()

Language::getNamespaces ( )

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.

Returns
array<int,string> List of localized namespace names, indexed by numeric namespace ID.

Definition at line 483 of file Language.php.

References $namespaceNames, getHookRunner(), NS_PROJECT, and NS_PROJECT_TALK.

Referenced by getFormattedNamespaces(), getNamespaceAliases(), getNamespaceIds(), and getNsText().

◆ getNsIndex()

Language::getNsIndex ( $text)

Get a namespace key by value, case insensitive.

Canonical namespace names override custom ones defined for the current language.

Parameters
string$text
Returns
int|false An integer if $text is a valid value otherwise false

Definition at line 730 of file Language.php.

References getNamespaceIds(), and lc().

◆ getNsText()

Language::getNsText ( $index)

Get a namespace value by key.

Namespace name uses underscores (not spaces), e.g. 'MediaWiki_talk'.

$mw_ns = $lang->getNsText( NS_MEDIAWIKI_TALK ); echo $mw_ns; // prints 'MediaWiki_talk'

Parameters
int$indexThe array key of the namespace to return
Returns
string|false String if the namespace value exists, otherwise false

Definition at line 568 of file Language.php.

References getNamespaces().

Referenced by getFormattedNsText(), and getGenderNsText().

◆ getParentLanguage()

Language::getParentLanguage ( )

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).

Deprecated
since 1.35, use LanguageFactory::getParentLanguage
Returns
Language|null
Since
1.22

Definition at line 4324 of file Language.php.

◆ getPluralRuleIndexNumber()

Language::getPluralRuleIndexNumber ( $number)

Find the index number of the plural rule appropriate for the given number.

Parameters
int$number
Returns
int The index number of the plural rule

Definition at line 4845 of file Language.php.

◆ getPluralRules()

Language::getPluralRules ( )

Get the plural rules for the language.

Since
1.20
Returns
array Associative array with plural form number and plural rule as key-value pairs

Definition at line 4803 of file Language.php.

◆ getPluralRuleType()

Language::getPluralRuleType ( $number)

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

Since
1.22
Parameters
int$number
Returns
string The name of the plural rule type, e.g. one, two, few, many

Definition at line 4859 of file Language.php.

◆ getPluralRuleTypes()

Language::getPluralRuleTypes ( )

Get the plural rule types for the language.

Since
1.22
Returns
array Associative array with plural form number and plural rule type as key-value pairs

Definition at line 4824 of file Language.php.

◆ getPreferredVariant()

Language::getPreferredVariant ( )
Deprecated
since 1.35 use LanguageConverter::getPreferredVariant instead
Returns
string

Definition at line 4264 of file Language.php.

Referenced by LanguageKk\convertGrammar(), LanguageKk\lcfirst(), and LanguageKk\ucfirst().

◆ getSpecialPageAliases()

Language::getSpecialPageAliases ( )

Get special page names, as an associative array canonical name => array of valid names, including aliases.

Returns
string[][]

Definition at line 3129 of file Language.php.

◆ getURLVariant()

Language::getURLVariant ( )
Deprecated
since 1.35 use LanguageConverter::getURLVariant instead
Returns
string

Definition at line 4280 of file Language.php.

◆ getVariantname()

Language::getVariantname ( $code,
$usemsg = true )

short names for language variants used for language conversion links.

Parameters
string$code
bool$usemsgUse the "variantname-xyz" message if it exists
Returns
string

Definition at line 747 of file Language.php.

References getMessageFromDB(), and wfMessage().

◆ getVariants()

Language::getVariants ( )

Get the list of variants supported by this language see sample implementation in LanguageZh.php.

Deprecated
since 1.35 use LanguageConverter::getVariants instead
Returns
string[] An array of language codes

Definition at line 4256 of file Language.php.

Referenced by getNamespaceAliases().

◆ getWeekdayAbbreviation()

Language::getWeekdayAbbreviation ( $key)
Parameters
int$keyNumber from 1 to 7
Returns
string

Definition at line 914 of file Language.php.

◆ getWeekdayName()

Language::getWeekdayName ( $key)
Parameters
int$keyNumber from 1 to 7
Returns
string

Definition at line 906 of file Language.php.

◆ handleExplicitPluralForms()

Language::handleExplicitPluralForms ( $count,
array $forms )
protected

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().

Since
1.23
Parameters
int$countNon-localized number
string[]$formsDifferent plural forms
Returns
string[]|string

Definition at line 4002 of file Language.php.

Referenced by LanguageKsh\convertPlural().

◆ hasVariant()

Language::hasVariant ( $variant)

Strict check if the language has the specific variant.

Compare to LanguageConverter::validateVariant() which does a more lenient check and attempts to coerce the given code to a valid one.

Deprecated
since 1.35 use LanguageConverter::hasVariant instead
Since
1.19
Parameters
string$variant
Returns
bool

Definition at line 4221 of file Language.php.

◆ hasVariants()

Language::hasVariants ( )

Check if this is a language with variants.

Deprecated
since 1.35 use LanguageConverter::hasVariants instead
Returns
bool

Definition at line 4205 of file Language.php.

◆ hasWordBreaks()

Language::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 in LanguageYue, and LanguageZh_hans.

Definition at line 2829 of file Language.php.

◆ hebrewNumeral()

static Language::hebrewNumeral ( $num)
static

Hebrew Gematria number formatting up to 9999.

Parameters
int$num
Returns
string

Definition at line 1966 of file Language.php.

◆ iconv()

Language::iconv ( $in,
$out,
$string )
Parameters
string$in
string$out
string$string
Returns
string

Definition at line 2611 of file Language.php.

◆ insertSpace()

static Language::insertSpace ( $string,
$pattern )
staticprotected
Parameters
string$string
string$pattern
Returns
string

Definition at line 2883 of file Language.php.

Referenced by LanguageJa\segmentByWord(), LanguageYue\segmentByWord(), and LanguageZh_hans\segmentByWord().

◆ isKnownLanguageTag()

static Language::isKnownLanguageTag ( $tag)
static

Returns true if a language code is an IETF tag known to MediaWiki.

Deprecated
since 1.34, use LanguageNameUtils
Parameters
string$tag
Since
1.21
Returns
bool

Definition at line 378 of file Language.php.

◆ isRTL()

Language::isRTL ( )

For right-to-left language support.

Returns
bool

Definition at line 2993 of file Language.php.

◆ isSupportedLanguage()

static Language::isSupportedLanguage ( $code)
static

Checks whether any localisation is available for that language tag in MediaWiki (MessagesXx.php exists).

Deprecated
since 1.34, use LanguageNameUtils
Parameters
string$codeLanguage tag (in lower case)
Returns
bool Whether language is supported
Since
1.21

Definition at line 311 of file Language.php.

◆ isValidBuiltInCode()

static Language::isValidBuiltInCode ( $code)
static

Returns true if a language code is of a valid form for the purposes of internal customisation of MediaWiki, via Messages*.php or *.json.

Deprecated
since 1.34, use LanguageNameUtils
Parameters
string$code
Since
1.18
Returns
bool

Definition at line 363 of file Language.php.

◆ isValidCode()

static Language::isValidCode ( $code)
static

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.

Deprecated
since 1.34, use LanguageNameUtils
Parameters
string$code
Returns
bool False if the language code contains dangerous characters, e.g. HTML special characters or characters illegal in MediaWiki titles.

Definition at line 348 of file Language.php.

◆ isWellFormedLanguageTag()

static Language::isWellFormedLanguageTag ( $code,
$lenient = false )
static

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: https://github.com/unicode-org/icu/blob/37e295627156bc334e1f1e88807025fac984da0e/icu4j/main/tests/translit/src/com/ibm/icu/dev/test/translit/langtagRegex.txt

Parameters
string$code
bool$lenientWhether to allow '_' as separator. The default is only '-'.
Returns
bool
Since
1.21
Deprecated
since 1.39, use LanguageCode::isWellFormedLanguageTag

Definition at line 332 of file Language.php.

◆ lc()

Language::lc ( $str,
$first = false )
Parameters
string$str
bool$firstWhether to lowercase only the first character
Returns
string The string with lowercase conversion applied

Definition at line 2704 of file Language.php.

Referenced by getLocalNsIndex(), getNamespaceIds(), getNsIndex(), LanguageTr\lcfirst(), and LanguageTr\ucfirst().

◆ lcfirst()

Language::lcfirst ( $str)
Parameters
string$str
Returns
string The string with lowercase conversion applied to the first character

Reimplemented in LanguageKaa, LanguageKk, and LanguageTr.

Definition at line 2681 of file Language.php.

◆ linkPrefixCharset()

Language::linkPrefixCharset ( )

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

Returns
string

Definition at line 4312 of file Language.php.

◆ linkPrefixExtension()

Language::linkPrefixExtension ( )

To allow "foo[[bar]]" to extend the link over the whole word "foobar".

Returns
bool

Definition at line 3095 of file Language.php.

◆ linkTrail()

Language::linkTrail ( )

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

Returns
string

Definition at line 4302 of file Language.php.

◆ listToText()

Language::listToText ( array $list)

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".

Parameters
string[]$list
Returns
string

Definition at line 3436 of file Language.php.

◆ mbUpperChar()

Language::mbUpperChar ( $char)
protected

Convert character to uppercase, allowing overrides of the default mb_upper behaviour, which is buggy in many ways.

Having a conversion table can be useful during transitions between PHP versions where unicode changes happen. This can make some resources unreachable on-wiki, see discussion at T219279. Providing such a conversion table can allow to manage the transition period.

Since
1.34
Parameters
string$char
Returns
string

Definition at line 2671 of file Language.php.

◆ minimumGroupingDigits()

Language::minimumGroupingDigits ( )
Returns
int|null

Definition at line 3424 of file Language.php.

◆ msg()

Language::msg ( $msg,
$params )
protected

Get message object in this language.

Only for use inside this class.

Parameters
string$msgMessage name
mixed...$params Message parameters
Returns
Message

Definition at line 852 of file Language.php.

◆ needsGenderDistinction()

Language::needsGenderDistinction ( )

Whether this language uses gender-dependent namespace aliases.

See https://www.mediawiki.org/wiki/Manual:$wgExtraGenderNamespaces

Returns
bool
Since
1.18

Definition at line 614 of file Language.php.

References NS_USER, and NS_USER_TALK.

◆ normalize()

Language::normalize ( $s)

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.

Access: internal
Parameters
string$s
Returns
string

Reimplemented in LanguageAr, and LanguageMl.

Definition at line 2956 of file Language.php.

References $s.

◆ normalizeForSearch()

Language::normalizeForSearch ( $string)

Some languages have special punctuation need to be normalized.

Make such changes here.

Parameters
string$string
Returns
string

Reimplemented in LanguageZh_hans, LanguageBe_tarask, and LanguageYue.

Definition at line 2851 of file Language.php.

◆ parseFormattedNumber()

Language::parseFormattedNumber ( $number)
Parameters
string$number
Returns
string

Definition at line 3348 of file Language.php.

References $s.

◆ pipeList()

Language::pipeList ( array $list)

Same as commaList, but separate it with the pipe instead.

Parameters
string[]$listArray of strings to put in a pipe list
Returns
string

Definition at line 3486 of file Language.php.

References wfMessage().

◆ preConvertPlural()

Language::preConvertPlural ( $forms,
$count )
protected

Checks that convertPlural was given an array and pads it to requested amount of forms by copying the last one.

Parameters
array$forms
int$countHow many forms should there be at least
Returns
array Padded array of forms

Definition at line 4023 of file Language.php.

Referenced by LanguageKsh\convertPlural().

◆ removeBadCharFirst()

Language::removeBadCharFirst ( $string)
protected

Remove bytes that represent an incomplete Unicode character at the start of string (e.g.

bytes of the char are missing)

Parameters
string$string
Returns
string

Definition at line 3644 of file Language.php.

◆ removeBadCharLast()

Language::removeBadCharLast ( $string)
protected

Remove bytes that represent an incomplete Unicode character at the end of string (e.g.

bytes of the char are missing)

Parameters
string$string
Returns
string

Definition at line 3618 of file Language.php.

◆ resetNamespaces()

Language::resetNamespaces ( )

Resets all of the namespace caches.

Mainly used for testing

Deprecated
since 1.39 Use MediaWikiServices::resetServiceForTesting() instead.

Definition at line 535 of file Language.php.

◆ romanNumeral()

static Language::romanNumeral ( $num)
static

Roman number formatting up to 10000.

Parameters
int$num
Returns
string

Definition at line 1935 of file Language.php.

References $s.

◆ segmentByWord()

Language::segmentByWord ( $string)

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

Parameters
string$string
Returns
string

Reimplemented in LanguageJa, LanguageYue, and LanguageZh_hans.

Definition at line 2840 of file Language.php.

◆ segmentForDiff()

Language::segmentForDiff ( $text)

languages like Chinese need to be segmented in order for the diff to be of any use

Parameters
string$text
Returns
string

Reimplemented in LanguageZh.

Definition at line 4113 of file Language.php.

◆ semicolonList()

Language::semicolonList ( array $list)

Take a list of strings and build a locale-friendly semicolon-separated list, using the local semicolon-separator message.

Parameters
string[]$listArray of strings to put in a semicolon list
Returns
string

Definition at line 3474 of file Language.php.

References wfMessage().

◆ separatorTransformTable()

Language::separatorTransformTable ( )
Returns
string[]

Definition at line 3417 of file Language.php.

◆ setNamespaces()

Language::setNamespaces ( array $namespaces)

Arbitrarily set all of the namespace names at once.

Mainly used for testing

Parameters
string[]$namespacesArray of namespaces (id => name)

Definition at line 526 of file Language.php.

◆ specialList()

Language::specialList ( $page,
$details,
$oppositedm = true )

Make a list item, used by various special pages.

Parameters
string$pagePage link
string$detailsHTML safe text between brackets
bool$oppositedmAdd the direction mark opposite to your language, to display text properly
Returns
string HTML escaped

Definition at line 4754 of file Language.php.

◆ sprintfDate()

Language::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.

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 xit t (days in month) in Iranian calendar xiz z (day of the 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.

Parameters
string$format
string$ts14-character timestamp YYYYMMDDHHMMSS 01234567890123
DateTimeZone | null$zoneTimezone of $ts
int | null&$ttlThe amount of time (in seconds) the output may be cached for. Only makes sense if $ts is the current time.
Todo
handling of "o" format character for Iranian, Hebrew, Hijri & Thai?
Exceptions
MWException
Returns
string
-taint tainted

Definition at line 1037 of file Language.php.

◆ time()

Language::time ( $ts,
$adj = false,
$format = true,
$timecorrection = false )
Parameters
string$tsThe time format which needs to be turned into a date('YmdHis') format with wfTimestamp(TS_MW,$ts)
bool$adjWhether to adjust the time output according to the user configured offset ($timecorrection)
mixed$formatTrue to use user's date format preference
string | false$timecorrectionThe time offset as returned by validateTimeZone() in Special:Preferences
Returns
string

Definition at line 2224 of file Language.php.

References wfTimestamp().

Referenced by LanguageWa\timeanddate().

◆ timeanddate()

Language::timeanddate ( $ts,
$adj = false,
$format = true,
$timecorrection = false )
Parameters
string$tsThe time format which needs to be turned into a date('YmdHis') format with wfTimestamp(TS_MW,$ts)
bool$adjWhether to adjust the time output according to the user configured offset ($timecorrection)
mixed$formatWhat format to return, if it's false output the default one (default true)
string | false$timecorrectionThe time offset as returned by validateTimeZone() in Special:Preferences
Returns
string

Reimplemented in LanguageWa.

Definition at line 2244 of file Language.php.

References wfTimestamp().

◆ transformUsingPairFile()

Language::transformUsingPairFile ( string $dataClass,
string $input )
protected

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.

Parameters
string$dataClassName of a normalize pairs data class
string$input
Returns
string

Definition at line 2980 of file Language.php.

Referenced by LanguageAr\normalize(), and LanguageMl\normalize().

◆ translateBlockExpiry()

Language::translateBlockExpiry ( $str,
UserIdentity $user = null,
$now = 0 )
Todo
Maybe translate block durations. Note that this function is somewhat misnamed: it deals with translating the duration ("1 week", "4 days", etc), not the expiry time (which is an absolute timestamp). Please note: do NOT add this blindly, as it is used on old expiry lengths recorded in log entries. You'd need to provide the start date to match up with it.
Parameters
string$strThe validated block duration in English
UserIdentity | null$userUser to use timezone from or null for the context user
int$nowCurrent timestamp, for formatting relative block durations
Returns
string Somehow translated block duration
See also
LanguageFi.php for example implementation

Reimplemented in LanguageFi.

Definition at line 4070 of file Language.php.

References wfIsInfinity().

◆ truncateForDatabase()

Language::truncateForDatabase ( $string,
$length,
$ellipsis = '...',
$adjustLength = true )

Truncate a string to a specified length in bytes, appending an optional string (e.g.

for ellipsis)

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

Since
1.31
Parameters
string$stringString to truncate
int$lengthMaximum length in bytes
string$ellipsisString to append to the end of truncated text
bool$adjustLengthSubtract length of ellipsis from $length
Returns
string

Definition at line 3508 of file Language.php.

◆ truncateForVisual()

Language::truncateForVisual ( $string,
$length,
$ellipsis = '...',
$adjustLength = true )

Truncate a string to a specified number of characters, appending an optional string (e.g.

for ellipsis).

This provides multibyte version of truncateForDatabase() method of this class, suitable for truncation based on number of characters, instead of number of bytes.

The input should be a raw UTF-8 string and NOT be HTML escaped. It is not safe to truncate HTML-escaped strings, because the entity can be truncated! Use ::truncateHtml() if you need a specific number of HTML-encoded bytes, or ::truncateForDatabase() if you need a specific number of PHP bytes.

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

Since
1.31
Parameters
string$stringString to truncate
int$lengthMaximum number of characters
string$ellipsisString to append to the end of truncated text
bool$adjustLengthSubtract length of ellipsis from $length
Returns
string

Definition at line 3539 of file Language.php.

Referenced by TraditionalImageGallery\getCaptionHtml().

◆ truncateHtml()

Language::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

This is only intended for styled/linked text, such as HTML with tags like and , 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.

Parameters
string$textHTML string to truncate
int$length(zero/positive) Maximum length (including ellipses)
string$ellipsisString to append to the truncated text
Returns
string

Definition at line 3670 of file Language.php.

References wfMessage().

◆ uc()

Language::uc ( $str,
$first = false )
Parameters
string$str
bool$firstWhether to uppercase only the first character
Returns
string The string with uppercase conversion applied

Definition at line 2650 of file Language.php.

Referenced by LanguageTr\lcfirst(), and LanguageTr\ucfirst().

◆ ucfirst()

Language::ucfirst ( $str)
Parameters
string$str
Returns
string The string with uppercase conversion applied to the first character

Reimplemented in LanguageAz, LanguageKaa, LanguageKk, and LanguageTr.

Definition at line 2626 of file Language.php.

◆ ucwordbreaks()

Language::ucwordbreaks ( $str)

capitalize words at word breaks

Parameters
string$str
Returns
mixed

Definition at line 2750 of file Language.php.

References $matches.

◆ ucwords()

Language::ucwords ( $str)
Parameters
string$str
Returns
mixed|string

Definition at line 2724 of file Language.php.

References $matches.

◆ unsegmentForDiff()

Language::unsegmentForDiff ( $text)

and unsegment to show the result

Parameters
string$text
Returns
string

Reimplemented in LanguageZh.

Definition at line 4123 of file Language.php.

◆ userAdjust()

Language::userAdjust ( $ts,
$tz = false )

Used by date() and time() to adjust the time output.

Parameters
string$tsThe time in date('YmdHis') format
string | false$tzAdjust the time by this amount (default false, mean we get user timecorrection setting)
Returns
string

Definition at line 2053 of file Language.php.

References $t, and getUser().

Referenced by LanguageWa\date().

◆ userDate()

Language::userDate ( $ts,
UserIdentity $user,
array $options = [] )

Get the formatted date for the given timestamp and formatted for the given user.

Parameters
mixed$tsMixed: the time format which needs to be turned into a date('YmdHis') format with wfTimestamp(TS_MW,$ts)
UserIdentity$userUser used to get preferences for timezone and format
array$optionsArray, can contain the following keys:
  • 'timecorrection': time correction, can have the following values:
    • true: use user's preference
    • false: don't use time correction
    • int: value of time correction in minutes
  • 'format': format to use, can have the following values:
    • true: use user's preference
    • false: use default preference
    • string: format to use
Since
1.19
Returns
string

Definition at line 2385 of file Language.php.

◆ userTime()

Language::userTime ( $ts,
UserIdentity $user,
array $options = [] )

Get the formatted time for the given timestamp and formatted for the given user.

Parameters
mixed$tsThe time format which needs to be turned into a date('YmdHis') format with wfTimestamp(TS_MW,$ts)
UserIdentity$userUser used to get preferences for timezone and format
array$optionsArray, can contain the following keys:
  • 'timecorrection': time correction, can have the following values:
    • true: use user's preference
    • false: don't use time correction
    • int: value of time correction in minutes
  • 'format': format to use, can have the following values:
    • true: use user's preference
    • false: use default preference
    • string: format to use
Since
1.19
Returns
string

Definition at line 2408 of file Language.php.

◆ userTimeAndDate()

Language::userTimeAndDate ( $ts,
UserIdentity $user,
array $options = [] )

Get the formatted date and time for the given timestamp and formatted for the given user.

Parameters
mixed$tsThe time format which needs to be turned into a date('YmdHis') format with wfTimestamp(TS_MW,$ts)
UserIdentity$userUser used to get preferences for timezone and format
array$optionsArray, can contain the following keys:
  • 'timecorrection': time correction, can have the following values:
    • true: use user's preference
    • false: don't use time correction
    • int: value of time correction in minutes
  • 'format': format to use, can have the following values:
    • true: use user's preference
    • false: use default preference
    • string: format to use
Since
1.19
Returns
string

Definition at line 2431 of file Language.php.

Member Data Documentation

◆ $dateFormatStrings

string [][] Language::$dateFormatStrings = []

memoize

Deprecated
since 1.35, must be private

Definition at line 85 of file Language.php.

◆ $durationIntervals

int [] Language::$durationIntervals = self::DURATION_INTERVALS
static
Deprecated
since 1.35, use the DURATION_INTERVALS constant
Since
1.20

Definition at line 266 of file Language.php.

◆ $mCode

string Language::$mCode

Definition at line 70 of file Language.php.

◆ $mExtendedSpecialPageAliases

string [][] null Language::$mExtendedSpecialPageAliases

memoize

Deprecated
since 1.35, must be protected

Definition at line 92 of file Language.php.

◆ $mMagicExtensions

Language::$mMagicExtensions = []
Deprecated
since 1.35, use LocalisationCache with custom language config

Definition at line 75 of file Language.php.

◆ $mMonthAbbrevMsgs

Language::$mMonthAbbrevMsgs = self::MONTH_ABBREVIATED_MESSAGES
static
Deprecated
since 1.35, use the MONTH_ABBREVIATED_MESSAGES constant

Definition at line 202 of file Language.php.

◆ $mMonthMsgs

Language::$mMonthMsgs = self::MONTH_MESSAGES
static
Deprecated
since 1.35, use the MONTH_MESSAGES constant

Definition at line 180 of file Language.php.

◆ $mNamespaceIds

array<string,int> null Language::$mNamespaceIds
protected

Indexed by localized lower-cased namespace name.

Definition at line 97 of file Language.php.

◆ $namespaceAliases

array<string,int> null Language::$namespaceAliases
protected

Map from alias to namespace ID.

Definition at line 99 of file Language.php.

◆ $namespaceNames

array<int,string> null Language::$namespaceNames
protected

Indexed by numeric namespace ID.

Definition at line 95 of file Language.php.

◆ ALL

const Language::ALL = LanguageNameUtils::ALL

Return all known languages in fetchLanguageName(s).

Since
1.32
Deprecated
since 1.34, use LanguageNameUtils::ALL

Definition at line 59 of file Language.php.

◆ DURATION_INTERVALS

const Language::DURATION_INTERVALS
protected
Initial value:
= [
'millennia' => 31556952000,
'centuries' => 3155695200,
'decades' => 315569520,
'years' => 31556952,
'weeks' => 604800,
'days' => 86400,
'hours' => 3600,
'minutes' => 60,
'seconds' => 1,
]
Since
1.35

Definition at line 249 of file Language.php.

◆ HEBREW_CALENDAR_MONTH_GENITIVE_MESSAGES

const Language::HEBREW_CALENDAR_MONTH_GENITIVE_MESSAGES
Initial value:
= [
'hebrew-calendar-m1-gen', 'hebrew-calendar-m2-gen', 'hebrew-calendar-m3-gen',
'hebrew-calendar-m4-gen', 'hebrew-calendar-m5-gen', 'hebrew-calendar-m6-gen',
'hebrew-calendar-m7-gen', 'hebrew-calendar-m8-gen', 'hebrew-calendar-m9-gen',
'hebrew-calendar-m10-gen', 'hebrew-calendar-m11-gen', 'hebrew-calendar-m12-gen',
'hebrew-calendar-m6a-gen', 'hebrew-calendar-m6b-gen'
]
Since
1.35

Definition at line 228 of file Language.php.

◆ HEBREW_CALENDAR_MONTHS_MESSAGES

const Language::HEBREW_CALENDAR_MONTHS_MESSAGES
Initial value:
= [
'hebrew-calendar-m1', 'hebrew-calendar-m2', 'hebrew-calendar-m3',
'hebrew-calendar-m4', 'hebrew-calendar-m5', 'hebrew-calendar-m6',
'hebrew-calendar-m7', 'hebrew-calendar-m8', 'hebrew-calendar-m9',
'hebrew-calendar-m10', 'hebrew-calendar-m11', 'hebrew-calendar-m12',
'hebrew-calendar-m6a', 'hebrew-calendar-m6b'
]
Since
1.35

Definition at line 217 of file Language.php.

◆ HIJRI_CALENDAR_MONTH_MESSAGES

const Language::HIJRI_CALENDAR_MONTH_MESSAGES
Initial value:
= [
'hijri-calendar-m1', 'hijri-calendar-m2', 'hijri-calendar-m3',
'hijri-calendar-m4', 'hijri-calendar-m5', 'hijri-calendar-m6',
'hijri-calendar-m7', 'hijri-calendar-m8', 'hijri-calendar-m9',
'hijri-calendar-m10', 'hijri-calendar-m11', 'hijri-calendar-m12'
]
Since
1.35

Definition at line 239 of file Language.php.

◆ IRANIAN_CALENDAR_MONTHS_MESSAGES

const Language::IRANIAN_CALENDAR_MONTHS_MESSAGES
Initial value:
= [
'iranian-calendar-m1', 'iranian-calendar-m2', 'iranian-calendar-m3',
'iranian-calendar-m4', 'iranian-calendar-m5', 'iranian-calendar-m6',
'iranian-calendar-m7', 'iranian-calendar-m8', 'iranian-calendar-m9',
'iranian-calendar-m10', 'iranian-calendar-m11', 'iranian-calendar-m12'
]
Since
1.35

Definition at line 207 of file Language.php.

◆ MESSAGES_FALLBACKS

const Language::MESSAGES_FALLBACKS = LanguageFallback::MESSAGES

Return a fallback chain for messages in getFallbacksFor.

Since
1.32
Deprecated
since 1.35, use LanguageFallback::MESSAGES

Definition at line 144 of file Language.php.

◆ MONTH_ABBREVIATED_MESSAGES

const Language::MONTH_ABBREVIATED_MESSAGES
Initial value:
= [
'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug',
'sep', 'oct', 'nov', 'dec'
]
Since
1.35

Definition at line 194 of file Language.php.

◆ MONTH_GENITIVE_MESSAGES

const Language::MONTH_GENITIVE_MESSAGES
Initial value:
= [
'january-gen', 'february-gen', 'march-gen', 'april-gen', 'may-gen', 'june-gen',
'july-gen', 'august-gen', 'september-gen', 'october-gen', 'november-gen',
'december-gen'
]
Since
1.35

Definition at line 185 of file Language.php.

◆ MONTH_MESSAGES

const Language::MONTH_MESSAGES
Initial value:
= [
'january', 'february', 'march', 'april', 'may_long', 'june',
'july', 'august', 'september', 'october', 'november',
'december'
]
Since
1.35

Definition at line 171 of file Language.php.

◆ STRICT_FALLBACKS

const Language::STRICT_FALLBACKS = LanguageFallback::STRICT

Return a strict fallback chain in getFallbacksFor.

Since
1.32
Deprecated
since 1.35, use LanguageFallback::STRICT

Definition at line 151 of file Language.php.

◆ SUPPORTED

const Language::SUPPORTED = LanguageNameUtils::SUPPORTED

Return in fetchLanguageName(s) only the languages for which we have at least some localisation.

Since
1.32
Deprecated
since 1.34, use LanguageNameUtils::SUPPORTED

Definition at line 67 of file Language.php.

◆ WEEKDAY_ABBREVIATED_MESSAGES

const Language::WEEKDAY_ABBREVIATED_MESSAGES
Initial value:
= [
'sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'
]
Since
1.35

Definition at line 164 of file Language.php.

◆ WEEKDAY_MESSAGES

const Language::WEEKDAY_MESSAGES
Initial value:
= [
'sunday', 'monday', 'tuesday', 'wednesday', 'thursday',
'friday', 'saturday'
]
Since
1.35

Definition at line 156 of file Language.php.


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