Object creating LanguageFallbackChain objects in Wikibase.
More...
|
| newFromLanguage (Language $language, $mode=self::FALLBACK_ALL) |
| Get the fallback chain based a single language, and specified fallback level.
|
|
| newFromLanguageCode ( $languageCode, $mode=self::FALLBACK_ALL) |
| Get the fallback chain based a single language code, and specified fallback level.
|
|
| newFromContext (IContextSource $context) |
| Construct the fallback chain based on a context.
|
|
| 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.
|
|
| 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.
|
|
| setGetLanguageFallbacksFor ( $getLanguageFallbacksFor) |
|
|
const | FALLBACK_ALL = 0xff |
| Fallback levels.
|
|
const | FALLBACK_SELF = 1 |
| The language itself, e.g.
|
|
const | FALLBACK_VARIANTS = 2 |
| Other compatible languages that can be translated into the requested language (and translation is automatically done), e.g.
|
|
const | FALLBACK_OTHERS = 4 |
| All other language from the system fallback chain, e.g.
|
|
Object creating LanguageFallbackChain objects in Wikibase.
- Copyright
- GPL-2.0-or-later
- Author
- Liangent < liang.nosp@m.ent@.nosp@m.gmail.nosp@m..com >
◆ buildFromBabel()
Wikibase\Lib\LanguageFallbackChainFactory::buildFromBabel |
( |
array |
$babel | ) |
|
Build fallback chain array for a given babel array.
- Parameters
-
- Returns
- LanguageWithConversion[]
◆ 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_* |
LanguageFallbackChain[] | $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
- LanguageFallbackChain
◆ 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
- LanguageFallbackChain
◆ 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
- LanguageFallbackChain
◆ 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
- LanguageFallbackChain
◆ 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
- LanguageFallbackChain
◆ setGetLanguageFallbacksFor()
Wikibase\Lib\LanguageFallbackChainFactory::setGetLanguageFallbacksFor |
( |
|
$getLanguageFallbacksFor | ) |
|
- Parameters
-
callable | $getLanguageFallbacksFor | |
◆ $getLanguageFallbacksFor
Wikibase\Lib\LanguageFallbackChainFactory::$getLanguageFallbacksFor = 'Language::getFallbacksFor' |
|
private |
◆ $languageCache
Wikibase\Lib\LanguageFallbackChainFactory::$languageCache |
|
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: