Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Lib\LanguageFallbackChainFactory Class Reference

Object creating TermLanguageFallbackChain objects in Wikibase. More...

Public Member Functions

 __construct (?ContentLanguages $termsLanguages=null, ?LanguageFactory $languageFactory=null, ?LanguageConverterFactory $languageConverterFactory=null, ?LanguageFallback $languageFallback=null)
 
 newFromLanguage (Language $language)
 Get the fallback chain based a single language.
 
 newFromLanguageCode ( $languageCode)
 Get the fallback chain based a single language code.
 
 newFromContext (IContextSource $context)
 Construct the fallback chain based on a context.
 
 newFromUserAndLanguageCode (User $user, $languageCode)
 Construct the fallback chain based on a user and a language, currently from data provided by Extension:Babel.
 
 buildFromBabel (array $babel)
 Build fallback chain array for a given babel array.
 

Private Member Functions

 addLanguageToChain ( $language, array &$chain, array &$fetched)
 Add the given language to the chain (if it’s not included already).
 
 addLanguageAndVariantsToChain ( $language, array &$chain, array &$fetched)
 Add the given language and its variants to the chain (if not included already).
 
 addLanguageAndVariantsAndFallbacksToChain ( $language, array &$chain, array &$fetched)
 Add the given language, its variants and its explicit fallbacks to the chain (if not included already).
 
 addImplicitFallbacksToChain (array &$chain, array &$fetched)
 Add the implicit fallbacks for any language to the chain (if not included already).
 
 buildFromLanguage ( $language)
 Build a full fallback chain from the single given language, its variants and fallbacks.
 
 getBabel ( $languageCode, $user)
 
 getBabelCategoryNames ()
 

Private Attributes

 $termsLanguages
 
 $languageFactory
 
 $languageConverterFactory
 
 $languageFallback
 
 $languageCache = []
 
 $userLanguageCache = []
 

Detailed Description

Object creating TermLanguageFallbackChain objects in Wikibase.

Author
Liangent < liang.nosp@m.ent@.nosp@m.gmail.nosp@m..com >

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Lib\LanguageFallbackChainFactory::__construct ( ?ContentLanguages $termsLanguages = null,
?LanguageFactory $languageFactory = null,
?LanguageConverterFactory $languageConverterFactory = null,
?LanguageFallback $languageFallback = null )

Member Function Documentation

◆ addImplicitFallbacksToChain()

Wikibase\Lib\LanguageFallbackChainFactory::addImplicitFallbacksToChain ( array & $chain,
array & $fetched )
private

Add the implicit fallbacks for any language to the chain (if not included already).

For the explicit fallbacks (of a specific language), see addLanguageAndVariantsAndFallbacksToChain.

Parameters
LanguageWithConversion[]&$chainthe resulting chain
bool[]&$fetchedlanguage codes (as keys) that are already in the chain

◆ addLanguageAndVariantsAndFallbacksToChain()

Wikibase\Lib\LanguageFallbackChainFactory::addLanguageAndVariantsAndFallbacksToChain ( $language,
array & $chain,
array & $fetched )
private

Add the given language, its variants and its explicit fallbacks to the chain (if not included already).

For the implicit (non-strict) fallbacks, see addImplicitFallbacksToChain.

Parameters
Language | string$languagelanguage (code)
LanguageWithConversion[]&$chainthe resulting chain
bool[]&$fetchedlanguage codes (as keys) that are already in the chain

◆ addLanguageAndVariantsToChain()

Wikibase\Lib\LanguageFallbackChainFactory::addLanguageAndVariantsToChain ( $language,
array & $chain,
array & $fetched )
private

Add the given language and its variants to the chain (if not included already).

Parameters
Language | string$languagelanguage (code)
LanguageWithConversion[]&$chainthe resulting chain
bool[]&$fetchedlanguage codes (as keys) that are already in the chain

◆ addLanguageToChain()

Wikibase\Lib\LanguageFallbackChainFactory::addLanguageToChain ( $language,
array & $chain,
array & $fetched )
private

Add the given language to the chain (if it’s not included already).

Parameters
Language | string$languagelanguage (code)
LanguageWithConversion[]&$chainthe resulting chain
bool[]&$fetchedlanguage codes (as keys) that are already in the chain

◆ buildFromBabel()

Wikibase\Lib\LanguageFallbackChainFactory::buildFromBabel ( array $babel)

Build fallback chain array for a given babel array.

Parameters
array$babel
Returns
LanguageWithConversion[]

◆ buildFromLanguage()

Wikibase\Lib\LanguageFallbackChainFactory::buildFromLanguage ( $language)
private

Build a full fallback chain from the single given language, its variants and fallbacks.

Parameters
Language | string$language(code)
Returns
LanguageWithConversion[] the resulting chain

◆ getBabel()

Wikibase\Lib\LanguageFallbackChainFactory::getBabel ( $languageCode,
$user )
private

◆ getBabelCategoryNames()

Wikibase\Lib\LanguageFallbackChainFactory::getBabelCategoryNames ( )
private

◆ newFromContext()

Wikibase\Lib\LanguageFallbackChainFactory::newFromContext ( IContextSource $context)

Construct the fallback chain based on a context.

Currently it just uses user and language info in it.

Parameters
IContextSource$context
Returns
TermLanguageFallbackChain

◆ newFromLanguage()

Wikibase\Lib\LanguageFallbackChainFactory::newFromLanguage ( Language $language)

Get the fallback chain based a single language.

Parameters
Language$language
Returns
TermLanguageFallbackChain

◆ newFromLanguageCode()

Wikibase\Lib\LanguageFallbackChainFactory::newFromLanguageCode ( $languageCode)

Get the fallback chain based a single language code.

Parameters
string$languageCode
Returns
TermLanguageFallbackChain

◆ newFromUserAndLanguageCode()

Wikibase\Lib\LanguageFallbackChainFactory::newFromUserAndLanguageCode ( User $user,
$languageCode )

Construct the fallback chain based on a user and a language, currently from data provided by Extension:Babel.

Parameters
User$user
string$languageCode
Returns
TermLanguageFallbackChain

Member Data Documentation

◆ $languageCache

Wikibase\Lib\LanguageFallbackChainFactory::$languageCache = []
private

◆ $languageConverterFactory

Wikibase\Lib\LanguageFallbackChainFactory::$languageConverterFactory
private

◆ $languageFactory

Wikibase\Lib\LanguageFallbackChainFactory::$languageFactory
private

◆ $languageFallback

Wikibase\Lib\LanguageFallbackChainFactory::$languageFallback
private

◆ $termsLanguages

Wikibase\Lib\LanguageFallbackChainFactory::$termsLanguages
private

◆ $userLanguageCache

Wikibase\Lib\LanguageFallbackChainFactory::$userLanguageCache = []
private

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