Object representing either a verbatim language or a converted language.
More...
|
static | validateLanguageCode ( $code) |
| Validate a language code.
|
|
static | factory ( $language, $sourceLanguage=null) |
| Get a LanguageWithConversion object.
|
|
|
| __construct (?Language $language, $languageCode, Language $sourceLanguage=null, $sourceLanguageCode=null, Language $parentLanguage=null) |
|
| prepareForTranslate ( $text) |
| Insert a text snippet which will be translated later.
|
|
| executeTranslate () |
| Really execute translation.
|
|
Object representing either a verbatim language or a converted language.
Used for items in language fallback chain.
- Copyright
- GPL-2.0-or-later
- Author
- Liangent < liang.nosp@m.ent@.nosp@m.gmail.nosp@m..com >
◆ __construct()
Wikibase\Lib\LanguageWithConversion::__construct |
( |
?Language |
$language, |
|
|
|
$languageCode, |
|
|
Language |
$sourceLanguage = null , |
|
|
|
$sourceLanguageCode = null , |
|
|
Language |
$parentLanguage = null |
|
) |
| |
|
private |
- Parameters
-
null | Language | $language | |
string | $languageCode | |
null | Language | $sourceLanguage | |
null | string | $sourceLanguageCode | |
null | Language | $parentLanguage | |
◆ executeTranslate()
Wikibase\Lib\LanguageWithConversion::executeTranslate |
( |
| ) |
|
|
private |
Really execute translation.
◆ factory()
static Wikibase\Lib\LanguageWithConversion::factory |
( |
|
$language, |
|
|
|
$sourceLanguage = null |
|
) |
| |
|
static |
Get a LanguageWithConversion object.
- Parameters
-
Language | string | $language | Language (code) for this object |
Language | string | null | $sourceLanguage | Source language (code) if this is a converted language, or null |
- Exceptions
-
- Returns
- self
◆ getFetchLanguageCode()
Wikibase\Lib\LanguageWithConversion::getFetchLanguageCode |
( |
| ) |
|
Get the code of the language where data should be fetched.
- Returns
- string
◆ getLanguage()
Wikibase\Lib\LanguageWithConversion::getLanguage |
( |
| ) |
|
Get the language this object wraps.
- Returns
- Language
◆ getLanguageCode()
Wikibase\Lib\LanguageWithConversion::getLanguageCode |
( |
| ) |
|
Get the code of the language this object wraps.
- Returns
- string
◆ getSourceLanguage()
Wikibase\Lib\LanguageWithConversion::getSourceLanguage |
( |
| ) |
|
Get the source language defined.
- Returns
- Language
◆ getSourceLanguageCode()
Wikibase\Lib\LanguageWithConversion::getSourceLanguageCode |
( |
| ) |
|
Get the code of the source language defined.
- Returns
- string|null
◆ prepareForTranslate()
Wikibase\Lib\LanguageWithConversion::prepareForTranslate |
( |
|
$text | ) |
|
|
private |
Insert a text snippet which will be translated later.
Due to the implementation of language converter, massive calls with short text snippets may introduce big overhead. If it's foreseeable that some text will be translated later, add it here for batched translation.
Does nothing if this is not a converted language.
- Parameters
-
◆ translate()
Wikibase\Lib\LanguageWithConversion::translate |
( |
|
$text | ) |
|
Translate data after fetching them.
- Parameters
-
string | $text | Data to transform |
- Returns
- string
◆ validateLanguageCode()
static Wikibase\Lib\LanguageWithConversion::validateLanguageCode |
( |
|
$code | ) |
|
|
static |
Validate a language code.
Logic taken from class Language.
- Parameters
-
- Returns
- string Validated and normalized code.
- Exceptions
-
MWException | on invalid code |
◆ $language
Wikibase\Lib\LanguageWithConversion::$language |
|
private |
◆ $languageCode
Wikibase\Lib\LanguageWithConversion::$languageCode |
|
private |
◆ $objectCache
Wikibase\Lib\LanguageWithConversion::$objectCache = [] |
|
staticprivate |
◆ $parentLanguage
Wikibase\Lib\LanguageWithConversion::$parentLanguage |
|
private |
◆ $sourceLanguage
Wikibase\Lib\LanguageWithConversion::$sourceLanguage |
|
private |
◆ $sourceLanguageCode
Wikibase\Lib\LanguageWithConversion::$sourceLanguageCode |
|
private |
◆ $translateCache
Wikibase\Lib\LanguageWithConversion::$translateCache = [] |
|
private |
◆ $translatePool
Wikibase\Lib\LanguageWithConversion::$translatePool = [] |
|
private |
The documentation for this class was generated from the following file: