MediaWiki master
MediaWiki\Language\LanguageNameSearch Class Reference

Cross-Language Language name search. More...

Public Member Functions

 __construct (LanguageNameUtils $languageNameUtils)
 
 doSearch (string $searchKey, int $typos=0, ?string $userLanguage=null)
 Find languages with fuzzy matching.
 

Static Public Member Functions

static getIndex (string $name)
 
static search (string $searchKey, int $typos=0, ?string $userLanguage=null)
 Find languages with fuzzy matching.
 

Detailed Description

Cross-Language Language name search.

FIXME: This class can be marked as readonly once AutoLoaderStructureTest can parse "readonly" annotations.

Copyright (C) 2012 Alolita Sharma, Amir Aharoni, Arun Ganesh, Brandon Harris, Niklas Laxström, Pau Giner, Santhosh Thottingal, Siebrand Mazeland and other contributors.

Note
GPL-2.0-or-later

Definition at line 19 of file LanguageNameSearch.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Language\LanguageNameSearch::__construct ( LanguageNameUtils $languageNameUtils)

Definition at line 22 of file LanguageNameSearch.php.

Member Function Documentation

◆ doSearch()

MediaWiki\Language\LanguageNameSearch::doSearch ( string $searchKey,
int $typos = 0,
?string $userLanguage = null )

Find languages with fuzzy matching.

The order of results is following: 1: exact language code match 2: exact language name match in any language 3: prefix language name match in any language 4: infix language name match in any language

The returned language name for autocompletion is the first one that matches in this list: 1: exact match in [user, autonym, any other language] 2: prefix match in [user, autonym, any other language] 3: inline match in [user, autonym, any other language]

Parameters
string$searchKey
int$typos
string | null$userLanguageLanguage tag.
Returns
array

Definition at line 70 of file LanguageNameSearch.php.

◆ getIndex()

static MediaWiki\Language\LanguageNameSearch::getIndex ( string $name)
static

Definition at line 148 of file LanguageNameSearch.php.

◆ search()

static MediaWiki\Language\LanguageNameSearch::search ( string $searchKey,
int $typos = 0,
?string $userLanguage = null )
static

Find languages with fuzzy matching.

The order of results is following: 1: exact language code match 2: exact language name match in any language 3: prefix language name match in any language 4: infix language name match in any language

The returned language name for autocompletion is the first one that matches in this list: 1: exact match in [user, autonym, any other language] 2: prefix match in [user, autonym, any other language] 3: inline match in [user, autonym, any other language]

Parameters
string$searchKey
int$typos
string | null$userLanguageLanguage tag.
Returns
array

Definition at line 45 of file LanguageNameSearch.php.


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