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.
|
|
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 |
( |
| $languageCode, |
|
|
| $sourceLanguageCode = null, |
|
|
Language | $parentLanguage = null ) |
|
private |
- Parameters
-
string | $languageCode | |
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
◆ getLanguageCode()
Wikibase\Lib\LanguageWithConversion::getLanguageCode |
( |
| ) |
|
Get the code of the language this object wraps.
- Returns
- string
◆ 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
-
InvalidArgumentException | on invalid code |
◆ $languageCode
Wikibase\Lib\LanguageWithConversion::$languageCode |
|
private |
◆ $objectCache
Wikibase\Lib\LanguageWithConversion::$objectCache = [] |
|
staticprivate |
◆ $parentLanguage
Wikibase\Lib\LanguageWithConversion::$parentLanguage |
|
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: