MediaWiki REL1_35
Language Class Reference

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

Inheritance diagram for Language:
Collaboration diagram for Language:

Public Member Functions

 __construct ( $code=null, LocalisationCache $localisationCache=null, LanguageNameUtils $langNameUtils=null, LanguageFallback $langFallback=null, LanguageConverterFactory $converterFactory=null, HookContainer $hookContainer=null)
 
 __destruct ()
 Reduce memory usage PhanTypeSuspiciousNonTraversableForeach.
 
 __get (string $name)
 Use PHP's magic __get handler to handle lazy accessing to deprecated mConverter.
 
 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
 
 capitalizeAllNouns ()
 
 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.
 
 convertTitle ( $title)
 Convert a Title object to a string in the preferred variant.
 
 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 ()
 
 findVariantLink (&$link, &$nt, $ignoreOtherCond=false)
 If a language supports multiple variants, it is possible that non-existing link in one variant actually exists in another variant.
 
 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')
 Decode an expiry (block, protection, etc) which has come from the DB.
 
 formatNum ( $number, $nocommafy=false)
 Normally we output all numbers in plain en_US style, that is 293,291.235 for twohundredninetythreethousand-twohundredninetyone point twohundredthirtyfive.
 
 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
 
 getExtraUserToggles ()
 
 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.
 
 getHtmlCode ()
 Get the code in BCP 47 format which we can use inside of html lang="" tags.
 
 getHumanTimestamp (MWTimestamp $time, MWTimestamp $relativeTo=null, User $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, User $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
 
 updateConversionTable (LinkTarget $linkTarget)
 Refresh the cache of conversion tables when MediaWiki:Conversiontable* is updated.
 
 userAdjust ( $ts, $tz=false)
 Used by date() and time() to adjust the time output.
 
 userDate ( $ts, User $user, array $options=[])
 Get the formatted date for the given timestamp and formatted for the given user.
 
 userTime ( $ts, User $user, array $options=[])
 Get the formatted time for the given timestamp and formatted for the given user.
 
 userTimeAndDate ( $ts, User $user, array $options=[])
 Get the formatted date and time for the given timestamp and formatted for the given user.
 
 viewPrevNext (Title $title, $offset, $limit, array $query=[], $atend=false)
 Generate (prev x| next x) (20|50|100...) type links for paging.
 

Static Public Member Functions

static classFromCode ( $code, $fallback=true)
 
static clearCaches ()
 Intended for tests that may change configuration in a way that invalidates caches.
 
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='mw')
 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 ()
 Get the LocalisationCache instance.
 
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

 $dateFormatStrings = []
 memoize
 
 $mCode
 
array[] $mExtendedSpecialPageAliases
 memoize
 
 $mMagicExtensions = []
 
 $transformData = []
 ReplacementArray object memoize.
 
const ALL = LanguageNameUtils::ALL
 Return all known languages in fetchLanguageName(s).
 
const AS_AUTONYMS = LanguageNameUtils::AUTONYMS
 Return autonyms 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 array $durationIntervals = self::DURATION_INTERVALS
 
static $mHebrewCalendarMonthGenMsgs = self::HEBREW_CALENDAR_MONTH_GENITIVE_MESSAGES
 
static $mHebrewCalendarMonthMsgs = self::HEBREW_CALENDAR_MONTHS_MESSAGES
 
static $mHijriCalendarMonthMsgs = self::HIJRI_CALENDAR_MONTH_MESSAGES
 
static $mIranianCalendarMonthMsgs = self::IRANIAN_CALENDAR_MONTHS_MESSAGES
 
static array $mLangObjCache = []
 
static $mMonthAbbrevMsgs = self::MONTH_ABBREVIATED_MESSAGES
 
static $mMonthGenMsgs = self::MONTH_GENITIVE_MESSAGES
 
static $mMonthMsgs = self::MONTH_MESSAGES
 
static $mWeekdayAbbrevMsgs = self::WEEKDAY_ABBREVIATED_MESSAGES
 
static $mWeekdayMsgs = self::WEEKDAY_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)
 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 ( $file, $string, $basePath=null)
 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

 $mNamespaceIds
 
 $namespaceAliases
 
array null $namespaceNames
 
const DURATION_INTERVALS
 

Private Member Functions

 fixVariableInNamespace ( $talk)
 
 getHebrewCalendarMonthName ( $key)
 
 getHebrewCalendarMonthNameGen ( $key)
 
 getHijriCalendarMonthName ( $key)
 
 getHumanTimestampInternal (MWTimestamp $ts, MWTimestamp $relativeTo, User $user)
 Convert an MWTimestamp into a pretty human-readable timestamp using the given user preferences and relative base time.
 
 getIranianCalendarMonthName ( $key)
 
 internalUserTimeAndDate ( $type, $ts, User $user, array $options)
 Internal helper function for userDate(), userTime() and userTimeAndDate()
 
 isMultibyte ( $str)
 
 numLink (Title $title, $offset, $limit, array $query, $link, $tooltipMsg, $class)
 Helper function for viewPrevNext() that generates links.
 
 truncate_endBracket (&$tag, $tagType, $lastCh, &$openTags)
 truncateHtml() helper function (a) push or pop $tag from $openTags as needed (b) clear $tag value
 
 truncate_skip (&$ret, $text, $search, $start, $len=null)
 truncateHtml() helper function like strcspn() but adds the skipped chars to $ret
 
 truncateInternal ( $string, $length, $ellipsis, $adjustLength, callable $measureLength, callable $getSubstring)
 Internal method used for truncation.
 

Static Private Member Functions

static dateTimeObjFormat (&$dateTimeObj, $ts, $zone, $code)
 Pass through result from $dateTimeObj->format()
 
static hebrewYearStart ( $year)
 This calculates the Hebrew year start, as days since 1 September.
 
static strongDirFromContent ( $text='')
 Gets directionality of the first strongly directional codepoint, for embedBidi()
 
static tsToHebrew ( $ts)
 Converting Gregorian dates to Hebrew dates.
 
static tsToHijri ( $ts)
 Converting Gregorian dates to Hijri dates.
 
static tsToIranian ( $ts)
 Algorithm by Roozbeh Pournader and Mohammad Toossi to convert Gregorian dates to Iranian dates.
 
static tsToYear ( $ts, $cName)
 Algorithm to convert Gregorian dates to Thai solar dates, Minguo dates or Minguo dates.
 

Private Attributes

LanguageConverterFactory $converterFactory
 
array[] null $grammarTransformCache
 
HookContainer $hookContainer
 
HookRunner $hookRunner
 
LanguageFallback $langFallback
 
LanguageNameUtils $langNameUtils
 
LocalisationCache $localisationCache
 
 $mHtmlCode = null
 
const LRE = "\u{202A}"
 Unicode directional formatting characters, for embedBidi()
 
const PDF = "\u{202C}"
 
const RLE = "\u{202B}"
 

Static Private Attributes

static $GREG_DAYS = [ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ]
 
static $IRANIAN_DAYS = [ 31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29 ]
 
static $strongDirRegex = '/(?:([\x{41}-\x{5a}\x{61}-\x{7a}\x{aa}\x{b5}\x{ba}\x{c0}-\x{d6}\x{d8}-\x{f6}\x{f8}-\x{2b8}\x{2bb}-\x{2c1}\x{2d0}\x{2d1}\x{2e0}-\x{2e4}\x{2ee}\x{370}-\x{373}\x{376}\x{377}\x{37a}-\x{37d}\x{37f}\x{386}\x{388}-\x{38a}\x{38c}\x{38e}-\x{3a1}\x{3a3}-\x{3f5}\x{3f7}-\x{482}\x{48a}-\x{52f}\x{531}-\x{556}\x{559}-\x{55f}\x{561}-\x{587}\x{589}\x{903}-\x{939}\x{93b}\x{93d}-\x{940}\x{949}-\x{94c}\x{94e}-\x{950}\x{958}-\x{961}\x{964}-\x{980}\x{982}\x{983}\x{985}-\x{98c}\x{98f}\x{990}\x{993}-\x{9a8}\x{9aa}-\x{9b0}\x{9b2}\x{9b6}-\x{9b9}\x{9bd}-\x{9c0}\x{9c7}\x{9c8}\x{9cb}\x{9cc}\x{9ce}\x{9d7}\x{9dc}\x{9dd}\x{9df}-\x{9e1}\x{9e6}-\x{9f1}\x{9f4}-\x{9fa}\x{a03}\x{a05}-\x{a0a}\x{a0f}\x{a10}\x{a13}-\x{a28}\x{a2a}-\x{a30}\x{a32}\x{a33}\x{a35}\x{a36}\x{a38}\x{a39}\x{a3e}-\x{a40}\x{a59}-\x{a5c}\x{a5e}\x{a66}-\x{a6f}\x{a72}-\x{a74}\x{a83}\x{a85}-\x{a8d}\x{a8f}-\x{a91}\x{a93}-\x{aa8}\x{aaa}-\x{ab0}\x{ab2}\x{ab3}\x{ab5}-\x{ab9}\x{abd}-\x{ac0}\x{ac9}\x{acb}\x{acc}\x{ad0}\x{ae0}\x{ae1}\x{ae6}-\x{af0}\x{af9}\x{b02}\x{b03}\x{b05}-\x{b0c}\x{b0f}\x{b10}\x{b13}-\x{b28}\x{b2a}-\x{b30}\x{b32}\x{b33}\x{b35}-\x{b39}\x{b3d}\x{b3e}\x{b40}\x{b47}\x{b48}\x{b4b}\x{b4c}\x{b57}\x{b5c}\x{b5d}\x{b5f}-\x{b61}\x{b66}-\x{b77}\x{b83}\x{b85}-\x{b8a}\x{b8e}-\x{b90}\x{b92}-\x{b95}\x{b99}\x{b9a}\x{b9c}\x{b9e}\x{b9f}\x{ba3}\x{ba4}\x{ba8}-\x{baa}\x{bae}-\x{bb9}\x{bbe}\x{bbf}\x{bc1}\x{bc2}\x{bc6}-\x{bc8}\x{bca}-\x{bcc}\x{bd0}\x{bd7}\x{be6}-\x{bf2}\x{c01}-\x{c03}\x{c05}-\x{c0c}\x{c0e}-\x{c10}\x{c12}-\x{c28}\x{c2a}-\x{c39}\x{c3d}\x{c41}-\x{c44}\x{c58}-\x{c5a}\x{c60}\x{c61}\x{c66}-\x{c6f}\x{c7f}\x{c82}\x{c83}\x{c85}-\x{c8c}\x{c8e}-\x{c90}\x{c92}-\x{ca8}\x{caa}-\x{cb3}\x{cb5}-\x{cb9}\x{cbd}-\x{cc4}\x{cc6}-\x{cc8}\x{cca}\x{ccb}\x{cd5}\x{cd6}\x{cde}\x{ce0}\x{ce1}\x{ce6}-\x{cef}\x{cf1}\x{cf2}\x{d02}\x{d03}\x{d05}-\x{d0c}\x{d0e}-\x{d10}\x{d12}-\x{d3a}\x{d3d}-\x{d40}\x{d46}-\x{d48}\x{d4a}-\x{d4c}\x{d4e}\x{d57}\x{d5f}-\x{d61}\x{d66}-\x{d75}\x{d79}-\x{d7f}\x{d82}\x{d83}\x{d85}-\x{d96}\x{d9a}-\x{db1}\x{db3}-\x{dbb}\x{dbd}\x{dc0}-\x{dc6}\x{dcf}-\x{dd1}\x{dd8}-\x{ddf}\x{de6}-\x{def}\x{df2}-\x{df4}\x{e01}-\x{e30}\x{e32}\x{e33}\x{e40}-\x{e46}\x{e4f}-\x{e5b}\x{e81}\x{e82}\x{e84}\x{e87}\x{e88}\x{e8a}\x{e8d}\x{e94}-\x{e97}\x{e99}-\x{e9f}\x{ea1}-\x{ea3}\x{ea5}\x{ea7}\x{eaa}\x{eab}\x{ead}-\x{eb0}\x{eb2}\x{eb3}\x{ebd}\x{ec0}-\x{ec4}\x{ec6}\x{ed0}-\x{ed9}\x{edc}-\x{edf}\x{f00}-\x{f17}\x{f1a}-\x{f34}\x{f36}\x{f38}\x{f3e}-\x{f47}\x{f49}-\x{f6c}\x{f7f}\x{f85}\x{f88}-\x{f8c}\x{fbe}-\x{fc5}\x{fc7}-\x{fcc}\x{fce}-\x{fda}\x{1000}-\x{102c}\x{1031}\x{1038}\x{103b}\x{103c}\x{103f}-\x{1057}\x{105a}-\x{105d}\x{1061}-\x{1070}\x{1075}-\x{1081}\x{1083}\x{1084}\x{1087}-\x{108c}\x{108e}-\x{109c}\x{109e}-\x{10c5}\x{10c7}\x{10cd}\x{10d0}-\x{1248}\x{124a}-\x{124d}\x{1250}-\x{1256}\x{1258}\x{125a}-\x{125d}\x{1260}-\x{1288}\x{128a}-\x{128d}\x{1290}-\x{12b0}\x{12b2}-\x{12b5}\x{12b8}-\x{12be}\x{12c0}\x{12c2}-\x{12c5}\x{12c8}-\x{12d6}\x{12d8}-\x{1310}\x{1312}-\x{1315}\x{1318}-\x{135a}\x{1360}-\x{137c}\x{1380}-\x{138f}\x{13a0}-\x{13f5}\x{13f8}-\x{13fd}\x{1401}-\x{167f}\x{1681}-\x{169a}\x{16a0}-\x{16f8}\x{1700}-\x{170c}\x{170e}-\x{1711}\x{1720}-\x{1731}\x{1735}\x{1736}\x{1740}-\x{1751}\x{1760}-\x{176c}\x{176e}-\x{1770}\x{1780}-\x{17b3}\x{17b6}\x{17be}-\x{17c5}\x{17c7}\x{17c8}\x{17d4}-\x{17da}\x{17dc}\x{17e0}-\x{17e9}\x{1810}-\x{1819}\x{1820}-\x{1877}\x{1880}-\x{18a8}\x{18aa}\x{18b0}-\x{18f5}\x{1900}-\x{191e}\x{1923}-\x{1926}\x{1929}-\x{192b}\x{1930}\x{1931}\x{1933}-\x{1938}\x{1946}-\x{196d}\x{1970}-\x{1974}\x{1980}-\x{19ab}\x{19b0}-\x{19c9}\x{19d0}-\x{19da}\x{1a00}-\x{1a16}\x{1a19}\x{1a1a}\x{1a1e}-\x{1a55}\x{1a57}\x{1a61}\x{1a63}\x{1a64}\x{1a6d}-\x{1a72}\x{1a80}-\x{1a89}\x{1a90}-\x{1a99}\x{1aa0}-\x{1aad}\x{1b04}-\x{1b33}\x{1b35}\x{1b3b}\x{1b3d}-\x{1b41}\x{1b43}-\x{1b4b}\x{1b50}-\x{1b6a}\x{1b74}-\x{1b7c}\x{1b82}-\x{1ba1}\x{1ba6}\x{1ba7}\x{1baa}\x{1bae}-\x{1be5}\x{1be7}\x{1bea}-\x{1bec}\x{1bee}\x{1bf2}\x{1bf3}\x{1bfc}-\x{1c2b}\x{1c34}\x{1c35}\x{1c3b}-\x{1c49}\x{1c4d}-\x{1c7f}\x{1cc0}-\x{1cc7}\x{1cd3}\x{1ce1}\x{1ce9}-\x{1cec}\x{1cee}-\x{1cf3}\x{1cf5}\x{1cf6}\x{1d00}-\x{1dbf}\x{1e00}-\x{1f15}\x{1f18}-\x{1f1d}\x{1f20}-\x{1f45}\x{1f48}-\x{1f4d}\x{1f50}-\x{1f57}\x{1f59}\x{1f5b}\x{1f5d}\x{1f5f}-\x{1f7d}\x{1f80}-\x{1fb4}\x{1fb6}-\x{1fbc}\x{1fbe}\x{1fc2}-\x{1fc4}\x{1fc6}-\x{1fcc}\x{1fd0}-\x{1fd3}\x{1fd6}-\x{1fdb}\x{1fe0}-\x{1fec}\x{1ff2}-\x{1ff4}\x{1ff6}-\x{1ffc}\x{200e}\x{2071}\x{207f}\x{2090}-\x{209c}\x{2102}\x{2107}\x{210a}-\x{2113}\x{2115}\x{2119}-\x{211d}\x{2124}\x{2126}\x{2128}\x{212a}-\x{212d}\x{212f}-\x{2139}\x{213c}-\x{213f}\x{2145}-\x{2149}\x{214e}\x{214f}\x{2160}-\x{2188}\x{2336}-\x{237a}\x{2395}\x{249c}-\x{24e9}\x{26ac}\x{2800}-\x{28ff}\x{2c00}-\x{2c2e}\x{2c30}-\x{2c5e}\x{2c60}-\x{2ce4}\x{2ceb}-\x{2cee}\x{2cf2}\x{2cf3}\x{2d00}-\x{2d25}\x{2d27}\x{2d2d}\x{2d30}-\x{2d67}\x{2d6f}\x{2d70}\x{2d80}-\x{2d96}\x{2da0}-\x{2da6}\x{2da8}-\x{2dae}\x{2db0}-\x{2db6}\x{2db8}-\x{2dbe}\x{2dc0}-\x{2dc6}\x{2dc8}-\x{2dce}\x{2dd0}-\x{2dd6}\x{2dd8}-\x{2dde}\x{3005}-\x{3007}\x{3021}-\x{3029}\x{302e}\x{302f}\x{3031}-\x{3035}\x{3038}-\x{303c}\x{3041}-\x{3096}\x{309d}-\x{309f}\x{30a1}-\x{30fa}\x{30fc}-\x{30ff}\x{3105}-\x{312d}\x{3131}-\x{318e}\x{3190}-\x{31ba}\x{31f0}-\x{321c}\x{3220}-\x{324f}\x{3260}-\x{327b}\x{327f}-\x{32b0}\x{32c0}-\x{32cb}\x{32d0}-\x{32fe}\x{3300}-\x{3376}\x{337b}-\x{33dd}\x{33e0}-\x{33fe}\x{3400}-\x{4db5}\x{4e00}-\x{9fd5}\x{a000}-\x{a48c}\x{a4d0}-\x{a60c}\x{a610}-\x{a62b}\x{a640}-\x{a66e}\x{a680}-\x{a69d}\x{a6a0}-\x{a6ef}\x{a6f2}-\x{a6f7}\x{a722}-\x{a787}\x{a789}-\x{a7ad}\x{a7b0}-\x{a7b7}\x{a7f7}-\x{a801}\x{a803}-\x{a805}\x{a807}-\x{a80a}\x{a80c}-\x{a824}\x{a827}\x{a830}-\x{a837}\x{a840}-\x{a873}\x{a880}-\x{a8c3}\x{a8ce}-\x{a8d9}\x{a8f2}-\x{a8fd}\x{a900}-\x{a925}\x{a92e}-\x{a946}\x{a952}\x{a953}\x{a95f}-\x{a97c}\x{a983}-\x{a9b2}\x{a9b4}\x{a9b5}\x{a9ba}\x{a9bb}\x{a9bd}-\x{a9cd}\x{a9cf}-\x{a9d9}\x{a9de}-\x{a9e4}\x{a9e6}-\x{a9fe}\x{aa00}-\x{aa28}\x{aa2f}\x{aa30}\x{aa33}\x{aa34}\x{aa40}-\x{aa42}\x{aa44}-\x{aa4b}\x{aa4d}\x{aa50}-\x{aa59}\x{aa5c}-\x{aa7b}\x{aa7d}-\x{aaaf}\x{aab1}\x{aab5}\x{aab6}\x{aab9}-\x{aabd}\x{aac0}\x{aac2}\x{aadb}-\x{aaeb}\x{aaee}-\x{aaf5}\x{ab01}-\x{ab06}\x{ab09}-\x{ab0e}\x{ab11}-\x{ab16}\x{ab20}-\x{ab26}\x{ab28}-\x{ab2e}\x{ab30}-\x{ab65}\x{ab70}-\x{abe4}\x{abe6}\x{abe7}\x{abe9}-\x{abec}\x{abf0}-\x{abf9}\x{ac00}-\x{d7a3}\x{d7b0}-\x{d7c6}\x{d7cb}-\x{d7fb}\x{e000}-\x{fa6d}\x{fa70}-\x{fad9}\x{fb00}-\x{fb06}\x{fb13}-\x{fb17}\x{ff21}-\x{ff3a}\x{ff41}-\x{ff5a}\x{ff66}-\x{ffbe}\x{ffc2}-\x{ffc7}\x{ffca}-\x{ffcf}\x{ffd2}-\x{ffd7}\x{ffda}-\x{ffdc}\x{10000}-\x{1000b}\x{1000d}-\x{10026}\x{10028}-\x{1003a}\x{1003c}\x{1003d}\x{1003f}-\x{1004d}\x{10050}-\x{1005d}\x{10080}-\x{100fa}\x{10100}\x{10102}\x{10107}-\x{10133}\x{10137}-\x{1013f}\x{101d0}-\x{101fc}\x{10280}-\x{1029c}\x{102a0}-\x{102d0}\x{10300}-\x{10323}\x{10330}-\x{1034a}\x{10350}-\x{10375}\x{10380}-\x{1039d}\x{1039f}-\x{103c3}\x{103c8}-\x{103d5}\x{10400}-\x{1049d}\x{104a0}-\x{104a9}\x{10500}-\x{10527}\x{10530}-\x{10563}\x{1056f}\x{10600}-\x{10736}\x{10740}-\x{10755}\x{10760}-\x{10767}\x{11000}\x{11002}-\x{11037}\x{11047}-\x{1104d}\x{11066}-\x{1106f}\x{11082}-\x{110b2}\x{110b7}\x{110b8}\x{110bb}-\x{110c1}\x{110d0}-\x{110e8}\x{110f0}-\x{110f9}\x{11103}-\x{11126}\x{1112c}\x{11136}-\x{11143}\x{11150}-\x{11172}\x{11174}-\x{11176}\x{11182}-\x{111b5}\x{111bf}-\x{111c9}\x{111cd}\x{111d0}-\x{111df}\x{111e1}-\x{111f4}\x{11200}-\x{11211}\x{11213}-\x{1122e}\x{11232}\x{11233}\x{11235}\x{11238}-\x{1123d}\x{11280}-\x{11286}\x{11288}\x{1128a}-\x{1128d}\x{1128f}-\x{1129d}\x{1129f}-\x{112a9}\x{112b0}-\x{112de}\x{112e0}-\x{112e2}\x{112f0}-\x{112f9}\x{11302}\x{11303}\x{11305}-\x{1130c}\x{1130f}\x{11310}\x{11313}-\x{11328}\x{1132a}-\x{11330}\x{11332}\x{11333}\x{11335}-\x{11339}\x{1133d}-\x{1133f}\x{11341}-\x{11344}\x{11347}\x{11348}\x{1134b}-\x{1134d}\x{11350}\x{11357}\x{1135d}-\x{11363}\x{11480}-\x{114b2}\x{114b9}\x{114bb}-\x{114be}\x{114c1}\x{114c4}-\x{114c7}\x{114d0}-\x{114d9}\x{11580}-\x{115b1}\x{115b8}-\x{115bb}\x{115be}\x{115c1}-\x{115db}\x{11600}-\x{11632}\x{1163b}\x{1163c}\x{1163e}\x{11641}-\x{11644}\x{11650}-\x{11659}\x{11680}-\x{116aa}\x{116ac}\x{116ae}\x{116af}\x{116b6}\x{116c0}-\x{116c9}\x{11700}-\x{11719}\x{11720}\x{11721}\x{11726}\x{11730}-\x{1173f}\x{118a0}-\x{118f2}\x{118ff}\x{11ac0}-\x{11af8}\x{12000}-\x{12399}\x{12400}-\x{1246e}\x{12470}-\x{12474}\x{12480}-\x{12543}\x{13000}-\x{1342e}\x{14400}-\x{14646}\x{16800}-\x{16a38}\x{16a40}-\x{16a5e}\x{16a60}-\x{16a69}\x{16a6e}\x{16a6f}\x{16ad0}-\x{16aed}\x{16af5}\x{16b00}-\x{16b2f}\x{16b37}-\x{16b45}\x{16b50}-\x{16b59}\x{16b5b}-\x{16b61}\x{16b63}-\x{16b77}\x{16b7d}-\x{16b8f}\x{16f00}-\x{16f44}\x{16f50}-\x{16f7e}\x{16f93}-\x{16f9f}\x{1b000}\x{1b001}\x{1bc00}-\x{1bc6a}\x{1bc70}-\x{1bc7c}\x{1bc80}-\x{1bc88}\x{1bc90}-\x{1bc99}\x{1bc9c}\x{1bc9f}\x{1d000}-\x{1d0f5}\x{1d100}-\x{1d126}\x{1d129}-\x{1d166}\x{1d16a}-\x{1d172}\x{1d183}\x{1d184}\x{1d18c}-\x{1d1a9}\x{1d1ae}-\x{1d1e8}\x{1d360}-\x{1d371}\x{1d400}-\x{1d454}\x{1d456}-\x{1d49c}\x{1d49e}\x{1d49f}\x{1d4a2}\x{1d4a5}\x{1d4a6}\x{1d4a9}-\x{1d4ac}\x{1d4ae}-\x{1d4b9}\x{1d4bb}\x{1d4bd}-\x{1d4c3}\x{1d4c5}-\x{1d505}\x{1d507}-\x{1d50a}\x{1d50d}-\x{1d514}\x{1d516}-\x{1d51c}\x{1d51e}-\x{1d539}\x{1d53b}-\x{1d53e}\x{1d540}-\x{1d544}\x{1d546}\x{1d54a}-\x{1d550}\x{1d552}-\x{1d6a5}\x{1d6a8}-\x{1d6da}\x{1d6dc}-\x{1d714}\x{1d716}-\x{1d74e}\x{1d750}-\x{1d788}\x{1d78a}-\x{1d7c2}\x{1d7c4}-\x{1d7cb}\x{1d800}-\x{1d9ff}\x{1da37}-\x{1da3a}\x{1da6d}-\x{1da74}\x{1da76}-\x{1da83}\x{1da85}-\x{1da8b}\x{1f110}-\x{1f12e}\x{1f130}-\x{1f169}\x{1f170}-\x{1f19a}\x{1f1e6}-\x{1f202}\x{1f210}-\x{1f23a}\x{1f240}-\x{1f248}\x{1f250}\x{1f251}\x{20000}-\x{2a6d6}\x{2a700}-\x{2b734}\x{2b740}-\x{2b81d}\x{2b820}-\x{2cea1}\x{2f800}-\x{2fa1d}\x{f0000}-\x{ffffd}\x{100000}-\x{10fffd}])|([\x{590}\x{5be}\x{5c0}\x{5c3}\x{5c6}\x{5c8}-\x{5ff}\x{7c0}-\x{7ea}\x{7f4}\x{7f5}\x{7fa}-\x{815}\x{81a}\x{824}\x{828}\x{82e}-\x{858}\x{85c}-\x{89f}\x{200f}\x{fb1d}\x{fb1f}-\x{fb28}\x{fb2a}-\x{fb4f}\x{10800}-\x{1091e}\x{10920}-\x{10a00}\x{10a04}\x{10a07}-\x{10a0b}\x{10a10}-\x{10a37}\x{10a3b}-\x{10a3e}\x{10a40}-\x{10ae4}\x{10ae7}-\x{10b38}\x{10b40}-\x{10e5f}\x{10e7f}-\x{10fff}\x{1e800}-\x{1e8cf}\x{1e8d7}-\x{1edff}\x{1ef00}-\x{1efff}\x{608}\x{60b}\x{60d}\x{61b}-\x{64a}\x{66d}-\x{66f}\x{671}-\x{6d5}\x{6e5}\x{6e6}\x{6ee}\x{6ef}\x{6fa}-\x{710}\x{712}-\x{72f}\x{74b}-\x{7a5}\x{7b1}-\x{7bf}\x{8a0}-\x{8e2}\x{fb50}-\x{fd3d}\x{fd40}-\x{fdcf}\x{fdf0}-\x{fdfc}\x{fdfe}\x{fdff}\x{fe70}-\x{fefe}\x{1ee00}-\x{1eeef}\x{1eef2}-\x{1eeff}]))/u'
 Directionality test regex for embedBidi().
 

Detailed Description

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

Definition at line 41 of file Language.php.

Constructor & Destructor Documentation

◆ __construct()

Language::__construct (   $code = null,
LocalisationCache  $localisationCache = null,
LanguageNameUtils  $langNameUtils = null,
LanguageFallback  $langFallback = null,
LanguageConverterFactory  $converterFactory = null,
HookContainer  $hookContainer = null 
)

Definition at line 503 of file Language.php.

◆ __destruct()

Language::__destruct ( )

Reduce memory usage PhanTypeSuspiciousNonTraversableForeach.

Definition at line 555 of file Language.php.

Member Function Documentation

◆ __get()

Language::__get ( string  $name)

Use PHP's magic __get handler to handle lazy accessing to deprecated mConverter.

Parameters
string$nameField name
Returns
mixed

Definition at line 71 of file Language.php.

References getConverter(), and wfDeprecatedMsg().

◆ 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 3107 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 3095 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 | bool$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 4129 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 4141 of file Language.php.

Referenced by LanguageZh\convertForSearchResult().

◆ capitalizeAllNouns()

Language::capitalizeAllNouns ( )
Returns
array

Definition at line 3151 of file Language.php.

◆ 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 2844 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 2853 of file Language.php.

References $s, and StringUtils\isUtf8().

◆ classFromCode()

static Language::classFromCode (   $code,
  $fallback = true 
)
static
Deprecated:
since 1.35, this is an internal method and should not need to be used elsewhere
Parameters
string$code
bool$fallbackWhether we're going through language fallback chain
Returns
string Name of the language class

Definition at line 4415 of file Language.php.

References $fallback, and wfDeprecated().

◆ clearCaches()

static Language::clearCaches ( )
static

Intended for tests that may change configuration in a way that invalidates caches.

Since
1.32
Deprecated:
since 1.35. Instead, reset all services and set Language::$mLangObjCache = [].

Definition at line 350 of file Language.php.

References wfDeprecated().

◆ commafy()

Language::commafy (   $number)

Adds commas to a given number.

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

Reimplemented in LanguageKm, and LanguageMy.

Definition at line 3326 of file Language.php.

References $digitGroupingPattern, $matches, and $minimumGroupingDigits.

◆ 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 3448 of file Language.php.

References wfMessage().

Referenced by MediaWiki\Block\BlockErrorFormatter\getBlockErrorMessageParams().

◆ 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 4159 of file Language.php.

◆ convertCategoryKey()

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

Definition at line 4235 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 2913 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 2943 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 3814 of file Language.php.

References $wgGrammarForms, and 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 sane

Definition at line 4225 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 4185 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 3951 of file Language.php.

◆ convertTitle()

Language::convertTitle (   $title)

Convert a Title object to a string in the preferred variant.

Deprecated:
since 1.35 use LanguageConverter::convertTitle
Parameters
Title$title
Returns
string

Definition at line 4171 of file Language.php.

References $title.

◆ 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 | bool$timecorrectionThe time offset as returned by validateTimeZone() in Special:Preferences
Returns
string

Reimplemented in LanguageWa.

Definition at line 2299 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 2232 of file Language.php.

References User\getDefaultOption().

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

◆ dateTimeObjFormat()

static Language::dateTimeObjFormat ( $dateTimeObj,
  $ts,
  $zone,
  $code 
)
staticprivate

Pass through result from $dateTimeObj->format()

Parameters
DateTime | bool | null&$dateTimeObj
string$ts
DateTimeZone | bool | null$zone
string$code
Returns
string

Definition at line 1061 of file Language.php.

◆ digitGroupingPattern()

Language::digitGroupingPattern ( )
Returns
string

Definition at line 3391 of file Language.php.

◆ digitTransformTable()

Language::digitTransformTable ( )
Returns
array

Definition at line 3398 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 4022 of file Language.php.

Referenced by MediaWiki\Block\BlockErrorFormatter\formatBlockerLink(), and MediaWiki\Block\BlockErrorFormatter\getFormattedBlockErrorInfo().

◆ 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 3235 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 4357 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
MWException
Returns
Language

Definition at line 340 of file Language.php.

◆ fallback8bitEncoding()

Language::fallback8bitEncoding ( )
Returns
string

Definition at line 2867 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 930 of file Language.php.

◆ fetchLanguageNames()

static Language::fetchLanguageNames (   $inLanguage = LanguageNameUtils::AUTONYMS,
  $include = 'mw' 
)
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 'mw' only if the language is defined in MediaWiki or wgExtraLanguageNames (default) LanguageNameUtils::SUPPORTED only if the language is in 'mw' and has a message file
Returns
array Language code => language name (sorted by key)
Since
1.20

Definition at line 913 of file Language.php.

◆ findVariantLink()

Language::findVariantLink ( $link,
$nt,
  $ignoreOtherCond = false 
)

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

Deprecated:
since 1.35 use LanguageConverter::findVariantLink instead
Parameters
string&$linkThe name of the link
Title&$ntThe title object of the link
bool$ignoreOtherCondTo disable other conditions when we need to transclude a template or update a category's link

Definition at line 4289 of file Language.php.

◆ firstChar()

Language::firstChar (   $s)

Get the first character of a string.

Parameters
string$s
Returns
string

Definition at line 2955 of file Language.php.

References $s.

◆ fixVariableInNamespace()

Language::fixVariableInNamespace (   $talk)
private
Parameters
string$talk
Returns
string

Definition at line 4553 of file Language.php.

References $wgMetaNamespace.

Referenced by getNamespaceAliases(), and getNamespaces().

◆ 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 4723 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 uesd
Returns
string

Definition at line 4735 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 2357 of file Language.php.

References wfMessage().

◆ formatExpiry()

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

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

Parameters
string$expiryDatabase expiry String
bool | 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
Returns
string
Since
1.18

Definition at line 4585 of file Language.php.

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

Referenced by MediaWiki\Block\BlockErrorFormatter\getFormattedBlockErrorInfo().

◆ formatNum()

Language::formatNum (   $number,
  $nocommafy = false 
)

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

Todo:
check if it's viable to use localeconv() for the decimal separator thing.
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$nocommafySet to true for special numbers like dates
Returns
string

Definition at line 3261 of file Language.php.

References $s, and $wgTranslateNumerals.

◆ 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 3291 of file Language.php.

◆ 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 4773 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 4616 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 3922 of file Language.php.

◆ getAllMessages()

Language::getAllMessages ( )
Returns
array

Definition at line 2651 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 3162 of file Language.php.

◆ getBookstoreList()

Language::getBookstoreList ( )

Exports $wgBookstoreListEn.

Returns
array

Definition at line 573 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 4369 of file Language.php.

Referenced by 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 Language code, or false if $prefix or $suffix isn't found

Definition at line 4397 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 4887 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 4115 of file Language.php.

Referenced by __get(), 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

Definition at line 4878 of file Language.php.

◆ getDateFormats()

Language::getDateFormats ( )
Returns
array

Definition at line 866 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 2263 of file Language.php.

References $type.

◆ getDatePreferenceMigrationMap()

Language::getDatePreferenceMigrationMap ( )
Returns
array

Definition at line 886 of file Language.php.

◆ getDatePreferences()

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

Definition at line 859 of file Language.php.

◆ getDefaultDateFormat()

Language::getDefaultDateFormat ( )
Returns
array|string

Definition at line 873 of file Language.php.

◆ getDefaultVariant()

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

Definition at line 4263 of file Language.php.

◆ getDir()

Language::getDir ( )

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

Returns
string

Definition at line 3083 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 3139 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 3122 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
array

Definition at line 2383 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 4301 of file Language.php.

◆ getExtraUserToggles()

Language::getExtraUserToggles ( )
Returns
array

Definition at line 893 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 4470 of file Language.php.

◆ getFallbackLanguages()

Language::getFallbackLanguages ( )
Returns
array
Since
1.19

Definition at line 565 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
array List of language codes

Definition at line 4487 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
array [ fallbacks, site fallbacks ]

Definition at line 4501 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 4435 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
array

Definition at line 644 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 681 of file Language.php.

References getNsText().

Referenced by LanguageConverter\convertNamespace().

◆ 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
Since
1.18

Definition at line 694 of file Language.php.

References $wgExtraGenderNamespaces, and getNsText().

◆ getGrammarForms()

Language::getGrammarForms ( )

Get the grammar forms for the content language.

Returns
array Array of grammar forms
Since
1.20

Definition at line 3865 of file Language.php.

References $wgGrammarForms.

◆ 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 3885 of file Language.php.

◆ getHebrewCalendarMonthName()

Language::getHebrewCalendarMonthName (   $key)
private
Parameters
int$key
Returns
string

Definition at line 1033 of file Language.php.

◆ getHebrewCalendarMonthNameGen()

Language::getHebrewCalendarMonthNameGen (   $key)
private
Parameters
int$key
Returns
string

Definition at line 1041 of file Language.php.

◆ getHijriCalendarMonthName()

Language::getHijriCalendarMonthName (   $key)
private
Parameters
int$key
Returns
string

Definition at line 1049 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 4976 of file Language.php.

◆ getHookRunner()

Language::getHookRunner ( )
protected

Get a HookRunner, for running core hooks.

Definition at line 4988 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 4383 of file Language.php.

◆ getHumanTimestamp()

Language::getHumanTimestamp ( MWTimestamp  $time,
MWTimestamp  $relativeTo = null,
User  $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)
User | null$userUser the timestamp is being generated for (or null to use main context's user)
Returns
string Formatted timestamp

Definition at line 2538 of file Language.php.

References MWTimestamp\offsetForUser().

◆ getHumanTimestampInternal()

Language::getHumanTimestampInternal ( MWTimestamp  $ts,
MWTimestamp  $relativeTo,
User  $user 
)
private

Convert an MWTimestamp into a pretty human-readable timestamp using the given user preferences and relative base time.

See also
Language::getHumanTimestamp
Parameters
MWTimestamp$tsTimestamp to prettify
MWTimestamp$relativeToBase timestamp
User$userUser preferences to use
Returns
string Human timestamp
Since
1.26

Definition at line 2575 of file Language.php.

References User\getDatePreference(), and wfMessage().

◆ getIranianCalendarMonthName()

Language::getIranianCalendarMonthName (   $key)
private
Parameters
int$key
Returns
string

Definition at line 1025 of file Language.php.

◆ 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 4457 of file Language.php.

◆ getLocalisationCache()

static Language::getLocalisationCache ( )
static

Get the LocalisationCache instance.

Deprecated:
since 1.34, use MediaWikiServices
Returns
LocalisationCache

Definition at line 489 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|bool An integer if $text is a valid value otherwise false

Definition at line 733 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 3201 of file Language.php.

References wfWarn().

◆ getMagicWords()

Language::getMagicWords ( )

Get all magic words from cache.

Returns
array

Definition at line 3192 of file Language.php.

◆ getMessage()

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

Reimplemented in LanguageQqx.

Definition at line 2644 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 4531 of file Language.php.

◆ getMessageFromDB()

Language::getMessageFromDB (   $msg)

Get a message from the MediaWiki namespace.

Parameters
string$msgMessage name
Returns
string

Definition at line 945 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
array Array of message keys (strings)

Definition at line 4545 of file Language.php.

◆ getMessagesFileName()

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

Definition at line 4445 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 4517 of file Language.php.

◆ getMonthAbbreviation()

Language::getMonthAbbreviation (   $key)
Parameters
int$key
Returns
string

Definition at line 990 of file Language.php.

◆ getMonthAbbreviationsArray()

Language::getMonthAbbreviationsArray ( )
Returns
array

Definition at line 997 of file Language.php.

◆ getMonthName()

Language::getMonthName (   $key)
Parameters
int$key
Returns
string

Definition at line 963 of file Language.php.

Referenced by LanguageWa\date().

◆ getMonthNameGen()

Language::getMonthNameGen (   $key)
Parameters
int$key
Returns
string

Definition at line 982 of file Language.php.

◆ getMonthNamesArray()

Language::getMonthNamesArray ( )
Returns
array

Definition at line 970 of file Language.php.

◆ getNamespaceAliases()

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

Definition at line 743 of file Language.php.

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

Referenced by getNamespaceIds().

◆ getNamespaceIds()

Language::getNamespaceIds ( )
Returns
array

Definition at line 800 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
string[] List of localized namespace names, indexed by numeric namespace ID.

Definition at line 583 of file Language.php.

References $namespaceNames, $wgExtraNamespaces, $wgMetaNamespace, $wgMetaNamespaceTalk, fixVariableInNamespace(), 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|bool An integer if $text is a valid value otherwise false

Definition at line 824 of file Language.php.

References getNamespaceIds(), and lc().

◆ getNsText()

Language::getNsText (   $index)

Get a namespace value by key.

$mw_ns = $lang->getNsText( NS_MEDIAWIKI ); echo $mw_ns; // prints 'MediaWiki'

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

Definition at line 663 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 4345 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 4950 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 4908 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 4964 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 4929 of file Language.php.

◆ getPreferredVariant()

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

Definition at line 4255 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
array

Definition at line 3218 of file Language.php.

◆ getURLVariant()

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

Definition at line 4271 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 842 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 4247 of file Language.php.

Referenced by getNamespaceAliases().

◆ getWeekdayAbbreviation()

Language::getWeekdayAbbreviation (   $key)
Parameters
int$key
Returns
string

Definition at line 1017 of file Language.php.

◆ getWeekdayName()

Language::getWeekdayName (   $key)
Parameters
int$key
Returns
string

Definition at line 1009 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
array$formsDifferent plural forms
Returns
array|string

Definition at line 3981 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 4212 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 4196 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 2879 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 2066 of file Language.php.

◆ hebrewYearStart()

static Language::hebrewYearStart (   $year)
staticprivate

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.

Parameters
int$year
Returns
string

Definition at line 1874 of file Language.php.

◆ iconv()

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

Definition at line 2661 of file Language.php.

◆ insertSpace()

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

Definition at line 2933 of file Language.php.

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

◆ internalUserTimeAndDate()

Language::internalUserTimeAndDate (   $type,
  $ts,
User  $user,
array  $options 
)
private

Internal helper function for userDate(), userTime() and userTimeAndDate()

Parameters
string$typeCan be 'date', 'time' or 'both'
string$tsThe time format which needs to be turned into a date('YmdHis') format with wfTimestamp(TS_MW,$ts)
User$userUser object 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 2434 of file Language.php.

References $type, User\getDatePreference(), User\getOption(), true, and wfTimestamp().

◆ 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 478 of file Language.php.

◆ isMultibyte()

Language::isMultibyte (   $str)
private
Parameters
string$str
Returns
bool

Definition at line 2766 of file Language.php.

◆ isRTL()

Language::isRTL ( )

For right-to-left language support.

Returns
bool

Definition at line 3075 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 372 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 463 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

Definition at line 448 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://www.unicode.org/repos/cldr/trunk/tools/java/org/unicode/cldr/util/data/langtagRegex.txt

Parameters
string$code
bool$lenientWhether to allow '_' as separator. The default is only '-'.
Returns
bool
Since
1.21

Definition at line 392 of file Language.php.

References $s.

◆ 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 2754 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 2731 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 4333 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 3184 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 4323 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 3424 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 2721 of file Language.php.

References $wgOverrideUcfirstCharacters.

◆ minimumGroupingDigits()

Language::minimumGroupingDigits ( )
Returns
int|null

Definition at line 3412 of file Language.php.

◆ msg()

Language::msg (   $msg)
protected

Get message object in this language.

Only for use inside this class.

Parameters
string$msgMessage name
Returns
Message

Definition at line 955 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 709 of file Language.php.

References $wgExtraGenderNamespaces, $wgExtraNamespaces, 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.

This is language-specific for performance reasons only.

Parameters
string$s
Returns
string

Reimplemented in LanguageAr, and LanguageMl.

Definition at line 3012 of file Language.php.

References $IP, $s, and $wgAllUnicodeFixes.

◆ 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 2901 of file Language.php.

◆ numLink()

Language::numLink ( Title  $title,
  $offset,
  $limit,
array  $query,
  $link,
  $tooltipMsg,
  $class 
)
private

Helper function for viewPrevNext() that generates links.

Deprecated:
since 1.35, used with viewPrevNext only
Parameters
Title$titleTitle object to link
int$offset
int$limit
array$queryExtra query parameters
string$linkText to use for the link; will be escaped
string$tooltipMsgName of the message to use as tooltip
string$classValue of the "class" attribute of the link
Returns
string HTML fragment

Definition at line 4860 of file Language.php.

References $title, and wfMessage().

◆ parseFormattedNumber()

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

Definition at line 3299 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 3473 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 4002 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 3624 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 3598 of file Language.php.

◆ resetNamespaces()

Language::resetNamespaces ( )

Resets all of the namespace caches.

Mainly used for testing

Definition at line 632 of file Language.php.

◆ romanNumeral()

static Language::romanNumeral (   $num)
static

Roman number formatting up to 10000.

Parameters
int$num
Returns
string

Definition at line 2035 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 2890 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 4092 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 3461 of file Language.php.

References wfMessage().

◆ separatorTransformTable()

Language::separatorTransformTable ( )
Returns
array

Definition at line 3405 of file Language.php.

◆ setNamespaces()

Language::setNamespaces ( array  $namespaces)

Arbitrarily set all of the namespace names at once.

Mainly used for testing

Parameters
array$namespacesArray of namespaces (id => name)

Definition at line 624 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 4787 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 1140 of file Language.php.

◆ strongDirFromContent()

static Language::strongDirFromContent (   $text = '')
staticprivate

Gets directionality of the first strongly directional codepoint, for embedBidi()

This is the rule the BIDI algorithm uses to determine the directionality of paragraphs ( https://www.unicode.org/reports/tr9/#The_Paragraph_Level ) and FSI isolates ( https://www.unicode.org/reports/tr9/#Explicit_Directional_Isolates ).

TODO: Does not handle BIDI control characters inside the text. TODO: Does not handle unallocated characters.

Parameters
string$textText to test
Returns
null|string Directionality ('ltr' or 'rtl') or null

Definition at line 2018 of file Language.php.

References $matches.

◆ 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 | bool$timecorrectionThe time offset as returned by validateTimeZone() in Special:Preferences
Returns
string

Definition at line 2318 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 | bool$timecorrectionThe time offset as returned by validateTimeZone() in Special:Preferences
Returns
string

Reimplemented in LanguageWa.

Definition at line 2338 of file Language.php.

References wfTimestamp().

◆ transformUsingPairFile()

Language::transformUsingPairFile (   $file,
  $string,
  $basePath = null 
)
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. This will go faster if you have the FastStringSearch extension.

Parameters
string$file
string$string
string | null$basePath
Exceptions
MWException
Returns
string

Definition at line 3039 of file Language.php.

References $basePath, $file, $IP, and wfDeprecated().

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

◆ translateBlockExpiry()

Language::translateBlockExpiry (   $str,
User  $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
User | null$userUser object to use timezone from or null for $wgUser
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 4049 of file Language.php.

References wfIsInfinity().

◆ truncate_endBracket()

Language::truncate_endBracket ( $tag,
  $tagType,
  $lastCh,
$openTags 
)
private

truncateHtml() helper function (a) push or pop $tag from $openTags as needed (b) clear $tag value

Parameters
string&$tagCurrent HTML tag name we are looking at
int$tagType(0-open tag, 1-close tag)
string$lastChCharacter before the '>' that ended this tag
array&$openTagsOpen tag stack (not accounting for $tag)

Definition at line 3792 of file Language.php.

◆ truncate_skip()

Language::truncate_skip ( $ret,
  $text,
  $search,
  $start,
  $len = null 
)
private

truncateHtml() helper function like strcspn() but adds the skipped chars to $ret

Parameters
string&$ret
string$text
string$search
int$start
null | int$len
Returns
int

Definition at line 3769 of file Language.php.

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

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 3519 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 3650 of file Language.php.

References wfMessage().

◆ truncateInternal()

Language::truncateInternal (   $string,
  $length,
  $ellipsis,
  $adjustLength,
callable  $measureLength,
callable  $getSubstring 
)
private

Internal method used for truncation.

This method abstracts text truncation into one common method, allowing users to provide length measurement function and function for finding substring.

For usages, see truncateForDatabase and truncateForVisual.

Parameters
string$stringString to truncate
int$lengthMaximum length of final text
string$ellipsisString to append to the end of truncated text
bool$adjustLengthSubtract length of ellipsis from $length
callable$measureLengthCallable function used for determining the length of text
callable$getSubstringCallable function used for getting the substrings
Returns
string

Definition at line 3545 of file Language.php.

References wfMessage().

◆ tsToHebrew()

static Language::tsToHebrew (   $ts)
staticprivate

Converting Gregorian dates to Hebrew dates.

Based on a JavaScript code by Abu Mami and Yisrael Hersch (abu-m.nosp@m.ami@.nosp@m.kalua.nosp@m.ch.n.nosp@m.et, 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.

Parameters
string$ts
Returns
int[]

Definition at line 1736 of file Language.php.

◆ tsToHijri()

static Language::tsToHijri (   $ts)
staticprivate

Converting Gregorian dates to Hijri dates.

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

See also
https://phpnuke.org/modules.php?name=News&file=article&sid=8234&mode=thread&order=0&thold=0
Parameters
string$ts
Returns
int[]

Definition at line 1684 of file Language.php.

◆ tsToIranian()

static Language::tsToIranian (   $ts)
staticprivate

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

Parameters
string$ts
Returns
int[]

Definition at line 1624 of file Language.php.

◆ tsToYear()

static Language::tsToYear (   $ts,
  $cName 
)
staticprivate

Algorithm to convert Gregorian dates to Thai solar dates, Minguo dates or Minguo dates.

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

Parameters
string$ts14-character timestamp
string$cNameCalender name
Returns
array Converted year, month, day

Definition at line 1912 of file Language.php.

◆ 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 2700 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 2676 of file Language.php.

◆ ucwordbreaks()

Language::ucwordbreaks (   $str)

capitalize words at word breaks

Parameters
string$str
Returns
mixed

Definition at line 2800 of file Language.php.

References $matches.

◆ ucwords()

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

Definition at line 2774 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 4102 of file Language.php.

◆ updateConversionTable()

Language::updateConversionTable ( LinkTarget  $linkTarget)

Refresh the cache of conversion tables when MediaWiki:Conversiontable* is updated.

Deprecated:
since 1.35 use LanguageConverter::updateConversionTable instead
Parameters
LinkTarget$linkTargetThe LinkTarget of the page being updated

Definition at line 4313 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
mixed$tzAdjust the time by this amount (default false, mean we get user timecorrection setting)
Returns
int

Definition at line 2153 of file Language.php.

References $t, and $wgLocalTZoffset.

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

◆ userDate()

Language::userDate (   $ts,
User  $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)
User$userUser object 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 2473 of file Language.php.

◆ userTime()

Language::userTime (   $ts,
User  $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)
User$userUser object 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 2496 of file Language.php.

◆ userTimeAndDate()

Language::userTimeAndDate (   $ts,
User  $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)
User$userUser object 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 2519 of file Language.php.

Referenced by MediaWiki\Block\BlockErrorFormatter\getFormattedBlockErrorInfo().

◆ viewPrevNext()

Language::viewPrevNext ( Title  $title,
  $offset,
  $limit,
array  $query = [],
  $atend = false 
)

Generate (prev x| next x) (20|50|100...) type links for paging.

Parameters
Title$titleTitle object to link
int$offset
int$limit
array$queryOptional URL query parameter string
bool$atendOptional param for specified if this is the last page
Returns
string
Deprecated:
since 1.34, use PrevNextNavigationRenderer::buildPrevNextNavigation() instead.

Definition at line 4811 of file Language.php.

References $title, wfDeprecated(), and wfMessage().

Member Data Documentation

◆ $converterFactory

LanguageConverterFactory Language::$converterFactory
private

Definition at line 128 of file Language.php.

◆ $dateFormatStrings

Language::$dateFormatStrings = []

memoize

Deprecated:
since 1.35, must be private

Definition at line 94 of file Language.php.

◆ $durationIntervals

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

Definition at line 308 of file Language.php.

◆ $grammarTransformCache

array [] null Language::$grammarTransformCache
private

Definition at line 123 of file Language.php.

◆ $GREG_DAYS

Language::$GREG_DAYS = [ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ]
staticprivate

Definition at line 1609 of file Language.php.

◆ $hookContainer

HookContainer Language::$hookContainer
private

Definition at line 133 of file Language.php.

◆ $hookRunner

HookRunner Language::$hookRunner
private

Definition at line 138 of file Language.php.

◆ $IRANIAN_DAYS

Language::$IRANIAN_DAYS = [ 31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29 ]
staticprivate

Definition at line 1610 of file Language.php.

◆ $langFallback

LanguageFallback Language::$langFallback
private

Definition at line 120 of file Language.php.

◆ $langNameUtils

LanguageNameUtils Language::$langNameUtils
private

Definition at line 117 of file Language.php.

◆ $localisationCache

LocalisationCache Language::$localisationCache
private

Definition at line 114 of file Language.php.

◆ $mCode

Language::$mCode

Definition at line 81 of file Language.php.

◆ $mExtendedSpecialPageAliases

array [] Language::$mExtendedSpecialPageAliases

memoize

Deprecated:
since 1.35, must be protected

Definition at line 101 of file Language.php.

◆ $mHebrewCalendarMonthGenMsgs

Language::$mHebrewCalendarMonthGenMsgs = self::HEBREW_CALENDAR_MONTH_GENITIVE_MESSAGES
static
Deprecated:
since 1.35, use the HEBREW_CALENDAR_MONTH_GENITIVE_MESSAGES constant

Definition at line 271 of file Language.php.

◆ $mHebrewCalendarMonthMsgs

Language::$mHebrewCalendarMonthMsgs = self::HEBREW_CALENDAR_MONTHS_MESSAGES
static
Deprecated:
since 1.35, use the HEBREW_CALENDAR_MONTHS_MESSAGES constant

Definition at line 255 of file Language.php.

◆ $mHijriCalendarMonthMsgs

Language::$mHijriCalendarMonthMsgs = self::HIJRI_CALENDAR_MONTH_MESSAGES
static
Deprecated:
since 1.35, use the HIJRI_CALENDAR_MONTH_MESSAGES constant

Definition at line 286 of file Language.php.

◆ $mHtmlCode

Language::$mHtmlCode = null
private

Definition at line 88 of file Language.php.

◆ $mIranianCalendarMonthMsgs

Language::$mIranianCalendarMonthMsgs = self::IRANIAN_CALENDAR_MONTHS_MESSAGES
static
Deprecated:
since 1.35, use the IRANIAN_CALENDAR_MONTHS_MESSAGES constant

Definition at line 239 of file Language.php.

◆ $mLangObjCache

array Language::$mLangObjCache = []
static
Deprecated:
since 1.35, use LanguageFactory

Definition at line 144 of file Language.php.

◆ $mMagicExtensions

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

Definition at line 86 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 224 of file Language.php.

◆ $mMonthGenMsgs

Language::$mMonthGenMsgs = self::MONTH_GENITIVE_MESSAGES
static
Deprecated:
since 1.35, use the MONTH_GENITIVE_MESSAGES constant

Definition at line 211 of file Language.php.

◆ $mMonthMsgs

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

Definition at line 197 of file Language.php.

◆ $mNamespaceIds

Language::$mNamespaceIds
protected

Definition at line 105 of file Language.php.

◆ $mWeekdayAbbrevMsgs

Language::$mWeekdayAbbrevMsgs = self::WEEKDAY_ABBREVIATED_MESSAGES
static
Deprecated:
since 1.35, use the WEEKDAY_ABBREVIATED_MESSAGES constant

Definition at line 183 of file Language.php.

◆ $mWeekdayMsgs

Language::$mWeekdayMsgs = self::WEEKDAY_MESSAGES
static
Deprecated:
since 1.35, use the WEEKDAY_MESSAGES constant

Definition at line 171 of file Language.php.

◆ $namespaceAliases

Language::$namespaceAliases
protected

Definition at line 105 of file Language.php.

◆ $namespaceNames

array null Language::$namespaceNames
protected

Definition at line 104 of file Language.php.

◆ $strongDirRegex

Language::$strongDirRegex = '/(?:([\x{41}-\x{5a}\x{61}-\x{7a}\x{aa}\x{b5}\x{ba}\x{c0}-\x{d6}\x{d8}-\x{f6}\x{f8}-\x{2b8}\x{2bb}-\x{2c1}\x{2d0}\x{2d1}\x{2e0}-\x{2e4}\x{2ee}\x{370}-\x{373}\x{376}\x{377}\x{37a}-\x{37d}\x{37f}\x{386}\x{388}-\x{38a}\x{38c}\x{38e}-\x{3a1}\x{3a3}-\x{3f5}\x{3f7}-\x{482}\x{48a}-\x{52f}\x{531}-\x{556}\x{559}-\x{55f}\x{561}-\x{587}\x{589}\x{903}-\x{939}\x{93b}\x{93d}-\x{940}\x{949}-\x{94c}\x{94e}-\x{950}\x{958}-\x{961}\x{964}-\x{980}\x{982}\x{983}\x{985}-\x{98c}\x{98f}\x{990}\x{993}-\x{9a8}\x{9aa}-\x{9b0}\x{9b2}\x{9b6}-\x{9b9}\x{9bd}-\x{9c0}\x{9c7}\x{9c8}\x{9cb}\x{9cc}\x{9ce}\x{9d7}\x{9dc}\x{9dd}\x{9df}-\x{9e1}\x{9e6}-\x{9f1}\x{9f4}-\x{9fa}\x{a03}\x{a05}-\x{a0a}\x{a0f}\x{a10}\x{a13}-\x{a28}\x{a2a}-\x{a30}\x{a32}\x{a33}\x{a35}\x{a36}\x{a38}\x{a39}\x{a3e}-\x{a40}\x{a59}-\x{a5c}\x{a5e}\x{a66}-\x{a6f}\x{a72}-\x{a74}\x{a83}\x{a85}-\x{a8d}\x{a8f}-\x{a91}\x{a93}-\x{aa8}\x{aaa}-\x{ab0}\x{ab2}\x{ab3}\x{ab5}-\x{ab9}\x{abd}-\x{ac0}\x{ac9}\x{acb}\x{acc}\x{ad0}\x{ae0}\x{ae1}\x{ae6}-\x{af0}\x{af9}\x{b02}\x{b03}\x{b05}-\x{b0c}\x{b0f}\x{b10}\x{b13}-\x{b28}\x{b2a}-\x{b30}\x{b32}\x{b33}\x{b35}-\x{b39}\x{b3d}\x{b3e}\x{b40}\x{b47}\x{b48}\x{b4b}\x{b4c}\x{b57}\x{b5c}\x{b5d}\x{b5f}-\x{b61}\x{b66}-\x{b77}\x{b83}\x{b85}-\x{b8a}\x{b8e}-\x{b90}\x{b92}-\x{b95}\x{b99}\x{b9a}\x{b9c}\x{b9e}\x{b9f}\x{ba3}\x{ba4}\x{ba8}-\x{baa}\x{bae}-\x{bb9}\x{bbe}\x{bbf}\x{bc1}\x{bc2}\x{bc6}-\x{bc8}\x{bca}-\x{bcc}\x{bd0}\x{bd7}\x{be6}-\x{bf2}\x{c01}-\x{c03}\x{c05}-\x{c0c}\x{c0e}-\x{c10}\x{c12}-\x{c28}\x{c2a}-\x{c39}\x{c3d}\x{c41}-\x{c44}\x{c58}-\x{c5a}\x{c60}\x{c61}\x{c66}-\x{c6f}\x{c7f}\x{c82}\x{c83}\x{c85}-\x{c8c}\x{c8e}-\x{c90}\x{c92}-\x{ca8}\x{caa}-\x{cb3}\x{cb5}-\x{cb9}\x{cbd}-\x{cc4}\x{cc6}-\x{cc8}\x{cca}\x{ccb}\x{cd5}\x{cd6}\x{cde}\x{ce0}\x{ce1}\x{ce6}-\x{cef}\x{cf1}\x{cf2}\x{d02}\x{d03}\x{d05}-\x{d0c}\x{d0e}-\x{d10}\x{d12}-\x{d3a}\x{d3d}-\x{d40}\x{d46}-\x{d48}\x{d4a}-\x{d4c}\x{d4e}\x{d57}\x{d5f}-\x{d61}\x{d66}-\x{d75}\x{d79}-\x{d7f}\x{d82}\x{d83}\x{d85}-\x{d96}\x{d9a}-\x{db1}\x{db3}-\x{dbb}\x{dbd}\x{dc0}-\x{dc6}\x{dcf}-\x{dd1}\x{dd8}-\x{ddf}\x{de6}-\x{def}\x{df2}-\x{df4}\x{e01}-\x{e30}\x{e32}\x{e33}\x{e40}-\x{e46}\x{e4f}-\x{e5b}\x{e81}\x{e82}\x{e84}\x{e87}\x{e88}\x{e8a}\x{e8d}\x{e94}-\x{e97}\x{e99}-\x{e9f}\x{ea1}-\x{ea3}\x{ea5}\x{ea7}\x{eaa}\x{eab}\x{ead}-\x{eb0}\x{eb2}\x{eb3}\x{ebd}\x{ec0}-\x{ec4}\x{ec6}\x{ed0}-\x{ed9}\x{edc}-\x{edf}\x{f00}-\x{f17}\x{f1a}-\x{f34}\x{f36}\x{f38}\x{f3e}-\x{f47}\x{f49}-\x{f6c}\x{f7f}\x{f85}\x{f88}-\x{f8c}\x{fbe}-\x{fc5}\x{fc7}-\x{fcc}\x{fce}-\x{fda}\x{1000}-\x{102c}\x{1031}\x{1038}\x{103b}\x{103c}\x{103f}-\x{1057}\x{105a}-\x{105d}\x{1061}-\x{1070}\x{1075}-\x{1081}\x{1083}\x{1084}\x{1087}-\x{108c}\x{108e}-\x{109c}\x{109e}-\x{10c5}\x{10c7}\x{10cd}\x{10d0}-\x{1248}\x{124a}-\x{124d}\x{1250}-\x{1256}\x{1258}\x{125a}-\x{125d}\x{1260}-\x{1288}\x{128a}-\x{128d}\x{1290}-\x{12b0}\x{12b2}-\x{12b5}\x{12b8}-\x{12be}\x{12c0}\x{12c2}-\x{12c5}\x{12c8}-\x{12d6}\x{12d8}-\x{1310}\x{1312}-\x{1315}\x{1318}-\x{135a}\x{1360}-\x{137c}\x{1380}-\x{138f}\x{13a0}-\x{13f5}\x{13f8}-\x{13fd}\x{1401}-\x{167f}\x{1681}-\x{169a}\x{16a0}-\x{16f8}\x{1700}-\x{170c}\x{170e}-\x{1711}\x{1720}-\x{1731}\x{1735}\x{1736}\x{1740}-\x{1751}\x{1760}-\x{176c}\x{176e}-\x{1770}\x{1780}-\x{17b3}\x{17b6}\x{17be}-\x{17c5}\x{17c7}\x{17c8}\x{17d4}-\x{17da}\x{17dc}\x{17e0}-\x{17e9}\x{1810}-\x{1819}\x{1820}-\x{1877}\x{1880}-\x{18a8}\x{18aa}\x{18b0}-\x{18f5}\x{1900}-\x{191e}\x{1923}-\x{1926}\x{1929}-\x{192b}\x{1930}\x{1931}\x{1933}-\x{1938}\x{1946}-\x{196d}\x{1970}-\x{1974}\x{1980}-\x{19ab}\x{19b0}-\x{19c9}\x{19d0}-\x{19da}\x{1a00}-\x{1a16}\x{1a19}\x{1a1a}\x{1a1e}-\x{1a55}\x{1a57}\x{1a61}\x{1a63}\x{1a64}\x{1a6d}-\x{1a72}\x{1a80}-\x{1a89}\x{1a90}-\x{1a99}\x{1aa0}-\x{1aad}\x{1b04}-\x{1b33}\x{1b35}\x{1b3b}\x{1b3d}-\x{1b41}\x{1b43}-\x{1b4b}\x{1b50}-\x{1b6a}\x{1b74}-\x{1b7c}\x{1b82}-\x{1ba1}\x{1ba6}\x{1ba7}\x{1baa}\x{1bae}-\x{1be5}\x{1be7}\x{1bea}-\x{1bec}\x{1bee}\x{1bf2}\x{1bf3}\x{1bfc}-\x{1c2b}\x{1c34}\x{1c35}\x{1c3b}-\x{1c49}\x{1c4d}-\x{1c7f}\x{1cc0}-\x{1cc7}\x{1cd3}\x{1ce1}\x{1ce9}-\x{1cec}\x{1cee}-\x{1cf3}\x{1cf5}\x{1cf6}\x{1d00}-\x{1dbf}\x{1e00}-\x{1f15}\x{1f18}-\x{1f1d}\x{1f20}-\x{1f45}\x{1f48}-\x{1f4d}\x{1f50}-\x{1f57}\x{1f59}\x{1f5b}\x{1f5d}\x{1f5f}-\x{1f7d}\x{1f80}-\x{1fb4}\x{1fb6}-\x{1fbc}\x{1fbe}\x{1fc2}-\x{1fc4}\x{1fc6}-\x{1fcc}\x{1fd0}-\x{1fd3}\x{1fd6}-\x{1fdb}\x{1fe0}-\x{1fec}\x{1ff2}-\x{1ff4}\x{1ff6}-\x{1ffc}\x{200e}\x{2071}\x{207f}\x{2090}-\x{209c}\x{2102}\x{2107}\x{210a}-\x{2113}\x{2115}\x{2119}-\x{211d}\x{2124}\x{2126}\x{2128}\x{212a}-\x{212d}\x{212f}-\x{2139}\x{213c}-\x{213f}\x{2145}-\x{2149}\x{214e}\x{214f}\x{2160}-\x{2188}\x{2336}-\x{237a}\x{2395}\x{249c}-\x{24e9}\x{26ac}\x{2800}-\x{28ff}\x{2c00}-\x{2c2e}\x{2c30}-\x{2c5e}\x{2c60}-\x{2ce4}\x{2ceb}-\x{2cee}\x{2cf2}\x{2cf3}\x{2d00}-\x{2d25}\x{2d27}\x{2d2d}\x{2d30}-\x{2d67}\x{2d6f}\x{2d70}\x{2d80}-\x{2d96}\x{2da0}-\x{2da6}\x{2da8}-\x{2dae}\x{2db0}-\x{2db6}\x{2db8}-\x{2dbe}\x{2dc0}-\x{2dc6}\x{2dc8}-\x{2dce}\x{2dd0}-\x{2dd6}\x{2dd8}-\x{2dde}\x{3005}-\x{3007}\x{3021}-\x{3029}\x{302e}\x{302f}\x{3031}-\x{3035}\x{3038}-\x{303c}\x{3041}-\x{3096}\x{309d}-\x{309f}\x{30a1}-\x{30fa}\x{30fc}-\x{30ff}\x{3105}-\x{312d}\x{3131}-\x{318e}\x{3190}-\x{31ba}\x{31f0}-\x{321c}\x{3220}-\x{324f}\x{3260}-\x{327b}\x{327f}-\x{32b0}\x{32c0}-\x{32cb}\x{32d0}-\x{32fe}\x{3300}-\x{3376}\x{337b}-\x{33dd}\x{33e0}-\x{33fe}\x{3400}-\x{4db5}\x{4e00}-\x{9fd5}\x{a000}-\x{a48c}\x{a4d0}-\x{a60c}\x{a610}-\x{a62b}\x{a640}-\x{a66e}\x{a680}-\x{a69d}\x{a6a0}-\x{a6ef}\x{a6f2}-\x{a6f7}\x{a722}-\x{a787}\x{a789}-\x{a7ad}\x{a7b0}-\x{a7b7}\x{a7f7}-\x{a801}\x{a803}-\x{a805}\x{a807}-\x{a80a}\x{a80c}-\x{a824}\x{a827}\x{a830}-\x{a837}\x{a840}-\x{a873}\x{a880}-\x{a8c3}\x{a8ce}-\x{a8d9}\x{a8f2}-\x{a8fd}\x{a900}-\x{a925}\x{a92e}-\x{a946}\x{a952}\x{a953}\x{a95f}-\x{a97c}\x{a983}-\x{a9b2}\x{a9b4}\x{a9b5}\x{a9ba}\x{a9bb}\x{a9bd}-\x{a9cd}\x{a9cf}-\x{a9d9}\x{a9de}-\x{a9e4}\x{a9e6}-\x{a9fe}\x{aa00}-\x{aa28}\x{aa2f}\x{aa30}\x{aa33}\x{aa34}\x{aa40}-\x{aa42}\x{aa44}-\x{aa4b}\x{aa4d}\x{aa50}-\x{aa59}\x{aa5c}-\x{aa7b}\x{aa7d}-\x{aaaf}\x{aab1}\x{aab5}\x{aab6}\x{aab9}-\x{aabd}\x{aac0}\x{aac2}\x{aadb}-\x{aaeb}\x{aaee}-\x{aaf5}\x{ab01}-\x{ab06}\x{ab09}-\x{ab0e}\x{ab11}-\x{ab16}\x{ab20}-\x{ab26}\x{ab28}-\x{ab2e}\x{ab30}-\x{ab65}\x{ab70}-\x{abe4}\x{abe6}\x{abe7}\x{abe9}-\x{abec}\x{abf0}-\x{abf9}\x{ac00}-\x{d7a3}\x{d7b0}-\x{d7c6}\x{d7cb}-\x{d7fb}\x{e000}-\x{fa6d}\x{fa70}-\x{fad9}\x{fb00}-\x{fb06}\x{fb13}-\x{fb17}\x{ff21}-\x{ff3a}\x{ff41}-\x{ff5a}\x{ff66}-\x{ffbe}\x{ffc2}-\x{ffc7}\x{ffca}-\x{ffcf}\x{ffd2}-\x{ffd7}\x{ffda}-\x{ffdc}\x{10000}-\x{1000b}\x{1000d}-\x{10026}\x{10028}-\x{1003a}\x{1003c}\x{1003d}\x{1003f}-\x{1004d}\x{10050}-\x{1005d}\x{10080}-\x{100fa}\x{10100}\x{10102}\x{10107}-\x{10133}\x{10137}-\x{1013f}\x{101d0}-\x{101fc}\x{10280}-\x{1029c}\x{102a0}-\x{102d0}\x{10300}-\x{10323}\x{10330}-\x{1034a}\x{10350}-\x{10375}\x{10380}-\x{1039d}\x{1039f}-\x{103c3}\x{103c8}-\x{103d5}\x{10400}-\x{1049d}\x{104a0}-\x{104a9}\x{10500}-\x{10527}\x{10530}-\x{10563}\x{1056f}\x{10600}-\x{10736}\x{10740}-\x{10755}\x{10760}-\x{10767}\x{11000}\x{11002}-\x{11037}\x{11047}-\x{1104d}\x{11066}-\x{1106f}\x{11082}-\x{110b2}\x{110b7}\x{110b8}\x{110bb}-\x{110c1}\x{110d0}-\x{110e8}\x{110f0}-\x{110f9}\x{11103}-\x{11126}\x{1112c}\x{11136}-\x{11143}\x{11150}-\x{11172}\x{11174}-\x{11176}\x{11182}-\x{111b5}\x{111bf}-\x{111c9}\x{111cd}\x{111d0}-\x{111df}\x{111e1}-\x{111f4}\x{11200}-\x{11211}\x{11213}-\x{1122e}\x{11232}\x{11233}\x{11235}\x{11238}-\x{1123d}\x{11280}-\x{11286}\x{11288}\x{1128a}-\x{1128d}\x{1128f}-\x{1129d}\x{1129f}-\x{112a9}\x{112b0}-\x{112de}\x{112e0}-\x{112e2}\x{112f0}-\x{112f9}\x{11302}\x{11303}\x{11305}-\x{1130c}\x{1130f}\x{11310}\x{11313}-\x{11328}\x{1132a}-\x{11330}\x{11332}\x{11333}\x{11335}-\x{11339}\x{1133d}-\x{1133f}\x{11341}-\x{11344}\x{11347}\x{11348}\x{1134b}-\x{1134d}\x{11350}\x{11357}\x{1135d}-\x{11363}\x{11480}-\x{114b2}\x{114b9}\x{114bb}-\x{114be}\x{114c1}\x{114c4}-\x{114c7}\x{114d0}-\x{114d9}\x{11580}-\x{115b1}\x{115b8}-\x{115bb}\x{115be}\x{115c1}-\x{115db}\x{11600}-\x{11632}\x{1163b}\x{1163c}\x{1163e}\x{11641}-\x{11644}\x{11650}-\x{11659}\x{11680}-\x{116aa}\x{116ac}\x{116ae}\x{116af}\x{116b6}\x{116c0}-\x{116c9}\x{11700}-\x{11719}\x{11720}\x{11721}\x{11726}\x{11730}-\x{1173f}\x{118a0}-\x{118f2}\x{118ff}\x{11ac0}-\x{11af8}\x{12000}-\x{12399}\x{12400}-\x{1246e}\x{12470}-\x{12474}\x{12480}-\x{12543}\x{13000}-\x{1342e}\x{14400}-\x{14646}\x{16800}-\x{16a38}\x{16a40}-\x{16a5e}\x{16a60}-\x{16a69}\x{16a6e}\x{16a6f}\x{16ad0}-\x{16aed}\x{16af5}\x{16b00}-\x{16b2f}\x{16b37}-\x{16b45}\x{16b50}-\x{16b59}\x{16b5b}-\x{16b61}\x{16b63}-\x{16b77}\x{16b7d}-\x{16b8f}\x{16f00}-\x{16f44}\x{16f50}-\x{16f7e}\x{16f93}-\x{16f9f}\x{1b000}\x{1b001}\x{1bc00}-\x{1bc6a}\x{1bc70}-\x{1bc7c}\x{1bc80}-\x{1bc88}\x{1bc90}-\x{1bc99}\x{1bc9c}\x{1bc9f}\x{1d000}-\x{1d0f5}\x{1d100}-\x{1d126}\x{1d129}-\x{1d166}\x{1d16a}-\x{1d172}\x{1d183}\x{1d184}\x{1d18c}-\x{1d1a9}\x{1d1ae}-\x{1d1e8}\x{1d360}-\x{1d371}\x{1d400}-\x{1d454}\x{1d456}-\x{1d49c}\x{1d49e}\x{1d49f}\x{1d4a2}\x{1d4a5}\x{1d4a6}\x{1d4a9}-\x{1d4ac}\x{1d4ae}-\x{1d4b9}\x{1d4bb}\x{1d4bd}-\x{1d4c3}\x{1d4c5}-\x{1d505}\x{1d507}-\x{1d50a}\x{1d50d}-\x{1d514}\x{1d516}-\x{1d51c}\x{1d51e}-\x{1d539}\x{1d53b}-\x{1d53e}\x{1d540}-\x{1d544}\x{1d546}\x{1d54a}-\x{1d550}\x{1d552}-\x{1d6a5}\x{1d6a8}-\x{1d6da}\x{1d6dc}-\x{1d714}\x{1d716}-\x{1d74e}\x{1d750}-\x{1d788}\x{1d78a}-\x{1d7c2}\x{1d7c4}-\x{1d7cb}\x{1d800}-\x{1d9ff}\x{1da37}-\x{1da3a}\x{1da6d}-\x{1da74}\x{1da76}-\x{1da83}\x{1da85}-\x{1da8b}\x{1f110}-\x{1f12e}\x{1f130}-\x{1f169}\x{1f170}-\x{1f19a}\x{1f1e6}-\x{1f202}\x{1f210}-\x{1f23a}\x{1f240}-\x{1f248}\x{1f250}\x{1f251}\x{20000}-\x{2a6d6}\x{2a700}-\x{2b734}\x{2b740}-\x{2b81d}\x{2b820}-\x{2cea1}\x{2f800}-\x{2fa1d}\x{f0000}-\x{ffffd}\x{100000}-\x{10fffd}])|([\x{590}\x{5be}\x{5c0}\x{5c3}\x{5c6}\x{5c8}-\x{5ff}\x{7c0}-\x{7ea}\x{7f4}\x{7f5}\x{7fa}-\x{815}\x{81a}\x{824}\x{828}\x{82e}-\x{858}\x{85c}-\x{89f}\x{200f}\x{fb1d}\x{fb1f}-\x{fb28}\x{fb2a}-\x{fb4f}\x{10800}-\x{1091e}\x{10920}-\x{10a00}\x{10a04}\x{10a07}-\x{10a0b}\x{10a10}-\x{10a37}\x{10a3b}-\x{10a3e}\x{10a40}-\x{10ae4}\x{10ae7}-\x{10b38}\x{10b40}-\x{10e5f}\x{10e7f}-\x{10fff}\x{1e800}-\x{1e8cf}\x{1e8d7}-\x{1edff}\x{1ef00}-\x{1efff}\x{608}\x{60b}\x{60d}\x{61b}-\x{64a}\x{66d}-\x{66f}\x{671}-\x{6d5}\x{6e5}\x{6e6}\x{6ee}\x{6ef}\x{6fa}-\x{710}\x{712}-\x{72f}\x{74b}-\x{7a5}\x{7b1}-\x{7bf}\x{8a0}-\x{8e2}\x{fb50}-\x{fd3d}\x{fd40}-\x{fdcf}\x{fdf0}-\x{fdfc}\x{fdfe}\x{fdff}\x{fe70}-\x{fefe}\x{1ee00}-\x{1eeef}\x{1eef2}-\x{1eeff}]))/u'
staticprivate

Directionality test regex for embedBidi().

Matches the first strong directionality codepoint:

  • in group 1 if it is LTR
  • in group 2 if it is RTL Does not match if there is no strong directionality codepoint.

The form is '/(?:([strong ltr codepoint])|([strong rtl codepoint]))/u' .

Generated by UnicodeJS (see tools/strongDir) from the UCD; see https://phabricator.wikimedia.org/diffusion/GUJS/ .

Definition at line 330 of file Language.php.

◆ $transformData

Language::$transformData = []

ReplacementArray object memoize.

Deprecated:
since 1.35, must be private

Definition at line 111 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 54 of file Language.php.

◆ AS_AUTONYMS

const Language::AS_AUTONYMS = LanguageNameUtils::AUTONYMS

Return autonyms in fetchLanguageName(s).

Since
1.32
Deprecated:
since 1.34, LanguageNameUtils::AUTONYMS

Definition at line 47 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 291 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 260 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 244 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 276 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 229 of file Language.php.

◆ LRE

const Language::LRE = "\u{202A}"
private

Unicode directional formatting characters, for embedBidi()

Definition at line 313 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 151 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 216 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 202 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 188 of file Language.php.

◆ PDF

const Language::PDF = "\u{202C}"
private

Definition at line 315 of file Language.php.

◆ RLE

const Language::RLE = "\u{202B}"
private

Definition at line 314 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 158 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 62 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 176 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 163 of file Language.php.


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