Wikibase
MediaWiki Wikibase extension
|
Service for looking up language names based on MediaWiki's Language class. More...
Public Member Functions | |
__construct (LanguageNameUtils $languageNameUtils, MessageInLanguageProvider $messageInLanguageProvider, ?string $inLanguage) | |
getName (string $languageCode) | |
Get the name of a language in a general context. | |
getNameForTerms (string $languageCode) | |
Get the name of a language when it is used in a "terms" context (labels/descriptions/aliases). | |
Private Member Functions | |
normalize (string $languageCode) | |
Private Attributes | |
LanguageNameUtils | $languageNameUtils |
MessageInLanguageProvider | $messageInLanguageProvider |
$inLanguage | |
Service for looking up language names based on MediaWiki's Language class.
Implementation note: wikibase.getLanguageNameByCode.js contains similar functionality in JS.
Wikibase\Lib\LanguageNameLookup::__construct | ( | LanguageNameUtils | $languageNameUtils, |
MessageInLanguageProvider | $messageInLanguageProvider, | ||
?string | $inLanguage ) |
LanguageNameUtils | $languageNameUtils | |
MessageInLanguageProvider | $messageInLanguageProvider | |
string | null | $inLanguage | Language code of the language in which to return the language names. Use LanguageNameUtils::AUTONYMS for autonyms (returns each language name in its own language). |
Wikibase\Lib\LanguageNameLookup::getName | ( | string | $languageCode | ) |
Get the name of a language in a general context.
If the language (code) is being used for terms (labels/descriptions/aliases), use self::getNameForTerms()
instead. On the other hand, language codes from WikibaseContentLanguages::CONTEXT_MONOLINGUAL_TEXT
, Site::getLanguageCode()
, or other non-term contexts, should use this method.
Wikibase\Lib\LanguageNameLookup::getNameForTerms | ( | string | $languageCode | ) |
Get the name of a language when it is used in a "terms" context (labels/descriptions/aliases).
Use this method when the language code is related to WikibaseContentLanguages::CONTEXT_TERM
or () WikibaseRepo::getTermsLanguages()
/ () WikibaseClient::getTermsLanguages()
.
The 'mul' language code has a special meaning for terms, and gets a distinct name in this context to communicate this meaning. For other language codes, this is equivalent to self::getName()
.
|
private |
|
private |
|
private |
|
private |