Object creating TermLanguageFallbackChain objects in Wikibase.
More...
|
| __construct (?LanguageFactory $languageFactory=null, ?LanguageConverterFactory $languageConverterFactory=null, ?LanguageFallback $languageFallback=null) |
|
| newFromLanguage (Language $language, $mode=self::FALLBACK_ALL) |
| Get the fallback chain based a single language, and specified fallback level. More...
|
|
| newFromLanguageCode ( $languageCode, $mode=self::FALLBACK_ALL) |
| Get the fallback chain based a single language code, and specified fallback level. More...
|
|
| newFromContext (IContextSource $context) |
| Construct the fallback chain based on a context. More...
|
|
| newFromContextAndLanguageCode (IContextSource $context, $languageCode) |
| Construct the fallback chain based on a context, but ignore the language info in it and use a specified one instead. More...
|
|
| newFromUserAndLanguageCode (User $user, $languageCode) |
| Construct the fallback chain based on a user and a language, currently from data provided by Extension:Babel. More...
|
|
| buildFromBabel (array $babel) |
| Build fallback chain array for a given babel array. More...
|
|
Object creating TermLanguageFallbackChain objects in Wikibase.
- Copyright
- GPL-2.0-or-later
- Author
- Liangent < liang.nosp@m.ent@.nosp@m.gmail.nosp@m..com >
◆ __construct()
Wikibase\Lib\LanguageFallbackChainFactory::__construct |
( |
?LanguageFactory |
$languageFactory = null , |
|
|
?LanguageConverterFactory |
$languageConverterFactory = null , |
|
|
?LanguageFallback |
$languageFallback = null |
|
) |
| |
◆ buildFromBabel()
Wikibase\Lib\LanguageFallbackChainFactory::buildFromBabel |
( |
array |
$babel | ) |
|
◆ buildFromLanguage()
Wikibase\Lib\LanguageFallbackChainFactory::buildFromLanguage |
( |
|
$language, |
|
|
|
$mode, |
|
|
array |
$chain = [] , |
|
|
array & |
$fetched = [] |
|
) |
| |
|
private |
Build fallback chain array for a given language or validated language code.
- Parameters
-
Language | string | $language | Language object or language code as string |
int | $mode | Bitfield of self::FALLBACK_* |
TermLanguageFallbackChain[] | $chain | for recursive calls |
bool[] | $fetched | for recursive calls |
- Exceptions
-
- Returns
- LanguageWithConversion[]
◆ 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
-
- Returns
- TermLanguageFallbackChain
◆ newFromContextAndLanguageCode()
Wikibase\Lib\LanguageFallbackChainFactory::newFromContextAndLanguageCode |
( |
IContextSource |
$context, |
|
|
|
$languageCode |
|
) |
| |
Construct the fallback chain based on a context, but ignore the language info in it and use a specified one instead.
- Parameters
-
IContextSource | $context | |
string | $languageCode | |
- Returns
- TermLanguageFallbackChain
◆ newFromLanguage()
Wikibase\Lib\LanguageFallbackChainFactory::newFromLanguage |
( |
Language |
$language, |
|
|
|
$mode = self::FALLBACK_ALL |
|
) |
| |
Get the fallback chain based a single language, and specified fallback level.
- Parameters
-
Language | $language | |
int | $mode | Bitfield of self::FALLBACK_* |
- Returns
- TermLanguageFallbackChain
◆ newFromLanguageCode()
Wikibase\Lib\LanguageFallbackChainFactory::newFromLanguageCode |
( |
|
$languageCode, |
|
|
|
$mode = self::FALLBACK_ALL |
|
) |
| |
Get the fallback chain based a single language code, and specified fallback level.
- Parameters
-
string | $languageCode | |
int | $mode | Bitfield of self::FALLBACK_* |
- 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
◆ $languageCache
Wikibase\Lib\LanguageFallbackChainFactory::$languageCache = [] |
|
private |
◆ $languageConverterFactory
Wikibase\Lib\LanguageFallbackChainFactory::$languageConverterFactory |
|
private |
◆ $languageFactory
Wikibase\Lib\LanguageFallbackChainFactory::$languageFactory |
|
private |
◆ $languageFallback
Wikibase\Lib\LanguageFallbackChainFactory::$languageFallback |
|
private |
◆ $userLanguageCache
Wikibase\Lib\LanguageFallbackChainFactory::$userLanguageCache = [] |
|
private |
◆ FALLBACK_ALL
const Wikibase\Lib\LanguageFallbackChainFactory::FALLBACK_ALL = 0xff |
◆ FALLBACK_OTHERS
const Wikibase\Lib\LanguageFallbackChainFactory::FALLBACK_OTHERS = 4 |
All other language from the system fallback chain, e.g.
'de' and 'en' for 'de-formal'.
◆ FALLBACK_SELF
const Wikibase\Lib\LanguageFallbackChainFactory::FALLBACK_SELF = 1 |
The language itself, e.g.
'en' for 'en'.
◆ FALLBACK_VARIANTS
const Wikibase\Lib\LanguageFallbackChainFactory::FALLBACK_VARIANTS = 2 |
Other compatible languages that can be translated into the requested language (and translation is automatically done), e.g.
'sr', 'sr-ec' and 'sr-el' for 'sr'.
The documentation for this class was generated from the following file: