FIXME: this class is not a language fallback chain.
More...
FIXME: this class is not a language fallback chain.
It takes and uses a fallback chain. The name thus needs to be updated to not be misleading.
- Copyright
- GPL-2.0-or-later
- Author
- Liangent < liang.nosp@m.ent@.nosp@m.gmail.nosp@m..com >
-
Thiemo Kreuz
◆ __construct()
Wikibase\Lib\LanguageFallbackChain::__construct |
( |
array |
$chain | ) |
|
- Parameters
-
LanguageWithConversion[] | $chain | |
◆ extractPreferredValue()
Wikibase\Lib\LanguageFallbackChain::extractPreferredValue |
( |
array |
$data | ) |
|
Try to fetch the best value in a multilingual data array.
- Parameters
-
string[] | array[] | $data | Multilingual data with language codes as keys |
- Exceptions
-
- Returns
- string[]|null of three items: array( 'value' => finally fetched and translated value 'language' => language code of the language which final value is in 'source' => language code of the language where the value is translated from ), or null when no "acceptable" data can be found.
◆ extractPreferredValueOrAny()
Wikibase\Lib\LanguageFallbackChain::extractPreferredValueOrAny |
( |
array |
$data | ) |
|
Try to fetch the best value in a multilingual data array first.
If no "acceptable" value exists, return any value known.
- Parameters
-
string[] | array[] | $data | Multilingual data with language codes as keys |
- Returns
- string[]|null of three items: array( 'value' => finally fetched and translated value 'language' => language code of the language which final value is in 'source' => language code of the language where the value is translated from ), or null when no data with a valid language code can be found.
◆ getFallbackChain()
Wikibase\Lib\LanguageFallbackChain::getFallbackChain |
( |
| ) |
|
Get raw fallback chain as an array.
Semi-private for testing.
- Returns
- LanguageWithConversion[]
◆ getFetchLanguageCodes()
Wikibase\Lib\LanguageFallbackChain::getFetchLanguageCodes |
( |
| ) |
|
Return language codes to use when fetching entries from the database.
- See also
- LanguageWithConversion::getFetchLanguageCode
- Returns
- string[]
◆ getValueArray()
Wikibase\Lib\LanguageFallbackChain::getValueArray |
( |
|
$value, |
|
|
|
$languageCode, |
|
|
|
$sourceLanguageCode = null |
|
) |
| |
|
private |
- Parameters
-
string | string[] | $value | |
string | $languageCode | |
string | null | $sourceLanguageCode | |
- Returns
- string[]
◆ $chain
Wikibase\Lib\LanguageFallbackChain::$chain |
|
private |
The documentation for this class was generated from the following file: