Wikibase
MediaWiki Wikibase extension
Wikibase\Repo\BabelUserLanguageLookup Class Reference

Service for looking up the languages understood by a user. More...

+ Inheritance diagram for Wikibase\Repo\BabelUserLanguageLookup:
+ Collaboration diagram for Wikibase\Repo\BabelUserLanguageLookup:

Public Member Functions

 getUserSpecifiedLanguages (User $user)
 Returns a list of languages the user specified in addition to the non-optional interface language. More...
 
 getAllUserLanguages (User $user)
 Collects all languages from all user settings we can reach at this point, in order of preference, duplicates stripped: More...
 

Protected Member Functions

 getBabelLanguages (User $user)
 

Private Attributes

 $babelLanguages = []
 

Detailed Description

Service for looking up the languages understood by a user.

The current implementation relies on the Babel extension, but that may change.

Author
Daniel Kinzler
Thiemo Kreuz
Marius Hoch

Member Function Documentation

◆ getAllUserLanguages()

Wikibase\Repo\BabelUserLanguageLookup::getAllUserLanguages ( User  $user)

Collects all languages from all user settings we can reach at this point, in order of preference, duplicates stripped:

  1. The interface language from the user's settings
  2. All languages in the user's Babel box Note: This can contain language codes not actually valid to MediaWiki or valid at all.
Parameters
User$userThe current user.
Returns
string[] List of all the user's language codes.

Implements Wikibase\Lib\UserLanguageLookup.

◆ getBabelLanguages()

Wikibase\Repo\BabelUserLanguageLookup::getBabelLanguages ( User  $user)
protected
Parameters
User$userThe current user.
Returns
string[] List of language codes in the users Babel box.

◆ getUserSpecifiedLanguages()

Wikibase\Repo\BabelUserLanguageLookup::getUserSpecifiedLanguages ( User  $user)

Returns a list of languages the user specified in addition to the non-optional interface language.

Note: This can contain language codes not actually valid to MediaWiki or valid at all.

Parameters
User$userThe current user.
Returns
string[] Which language codes the user specified.

Implements Wikibase\Lib\UserLanguageLookup.

Member Data Documentation

◆ $babelLanguages

Wikibase\Repo\BabelUserLanguageLookup::$babelLanguages = []
private

The documentation for this class was generated from the following file: