MediaWiki REL1_39
MediaWiki\Languages\LanguageFallback Class Reference

Public Member Functions

 __construct ( $siteLangCode, LocalisationCache $localisationCache, LanguageNameUtils $langNameUtils)
 Do not call this directly.
 
 getAll ( $code, $mode=self::MESSAGES)
 Get the ordered list of fallback languages.
 
 getAllIncludingSiteLanguage ( $code)
 Get the ordered list of fallback languages, ending with the fallback language chain for the site language.
 
 getFirst ( $code)
 Get the first fallback for a given language.
 

Public Attributes

const MESSAGES = 0
 Return a fallback chain for messages in getAll.
 
const STRICT = 1
 Return a strict fallback chain in getAll.
 

Detailed Description

Since
1.35

Definition at line 31 of file LanguageFallback.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Languages\LanguageFallback::__construct ( $siteLangCode,
LocalisationCache $localisationCache,
LanguageNameUtils $langNameUtils )

Do not call this directly.

Use MediaWikiServices.

Since
1.35
Parameters
string$siteLangCodeLanguage code of the site, typically $wgLanguageCode
LocalisationCache$localisationCache
LanguageNameUtils$langNameUtils

Definition at line 64 of file LanguageFallback.php.

Member Function Documentation

◆ getAll()

MediaWiki\Languages\LanguageFallback::getAll ( $code,
$mode = self::MESSAGES )

Get the ordered list of fallback languages.

Since
1.35
Parameters
string$codeLanguage code
int$modeFallback mode, either MESSAGES (which always falls back to 'en'), or STRICT (which only falls back to 'en' when explicitly defined)
Exceptions
InvalidArgumentExceptionIf $mode is invalid
Returns
string[] List of language codes

Definition at line 95 of file LanguageFallback.php.

References MediaWiki\Languages\LanguageFallback\MESSAGES, and MediaWiki\Languages\LanguageFallback\STRICT.

Referenced by MediaWiki\Languages\LanguageFallback\getAllIncludingSiteLanguage(), and MediaWiki\Languages\LanguageFallback\getFirst().

◆ getAllIncludingSiteLanguage()

MediaWiki\Languages\LanguageFallback::getAllIncludingSiteLanguage ( $code)

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

The site fallback list begins with the site language itself.

Since
1.35
Parameters
string$codeLanguage code
Returns
string[][] [ fallbacks, site fallbacks ]

Definition at line 136 of file LanguageFallback.php.

References MediaWiki\Languages\LanguageFallback\getAll().

◆ getFirst()

MediaWiki\Languages\LanguageFallback::getFirst ( $code)

Get the first fallback for a given language.

Since
1.35
Parameters
string$code
Returns
string|null

Definition at line 81 of file LanguageFallback.php.

References MediaWiki\Languages\LanguageFallback\getAll().

Member Data Documentation

◆ MESSAGES

const MediaWiki\Languages\LanguageFallback::MESSAGES = 0

Return a fallback chain for messages in getAll.

Since
1.35

Definition at line 36 of file LanguageFallback.php.

Referenced by MediaWiki\Languages\LanguageFallback\getAll().

◆ STRICT

const MediaWiki\Languages\LanguageFallback::STRICT = 1

Return a strict fallback chain in getAll.

Since
1.35

Definition at line 42 of file LanguageFallback.php.

Referenced by MediaWiki\Languages\LanguageFallback\getAll().


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