MediaWiki master
MediaWiki\Collation\IcuCollation Class Reference

Inherits MediaWiki\Collation\Collation.

Inherited by MediaWiki\Collation\CollationCkb, and MediaWiki\Collation\PinyinCollation.

Collaboration diagram for MediaWiki\Collation\IcuCollation:

Public Member Functions

 __construct (LanguageFactory $languageFactory, $locale)
 
 getFirstLetter ( $string)
 Given a string, return the logical "first letter" to be used for grouping on category pages and so on.This has to be coordinated carefully with convertToSortkey(), or else the sorted list might jump back and forth between the same "initial letters" or other pathological behavior. For instance, if you just return the first character, but "a" sorts the same as "A" based on getSortKey(), then you might get a list like== A ==

  • [[Aardvark]]
== a ==

  • [[antelope]]
== A ==

  • [[Ape]]
etc., assuming for the sake of argument that $wgCapitalLinks is false.
Since
1.16.3
Parameters
string$stringUTF-8 string
Returns
string UTF-8 string corresponding to the first letter of input

 
 getSortKey ( $string)
 Given a string, convert it to a (hopefully short) key that can be used for efficient sorting.A binary sort according to the sortkeys corresponds to a logical sort of the corresponding strings. Current code expects that a line feed character should sort before all others, but has no other particular expectations (and that one can be changed if necessary).
Since
1.16.3
Parameters
string$stringUTF-8 string
Returns
string Binary sortkey

 
- Public Member Functions inherited from MediaWiki\Collation\Collation
 getSortKeys ( $strings)
 Get multiple sort keys.
 

Static Public Member Functions

static isCjk ( $codepoint)
 Test if a code point is a CJK (Chinese, Japanese, Korean) character.
 

Protected Member Functions

 getPrimarySortKey (string $string)
 
 getRawSortLetter (string $string)
 

Protected Attributes

Language $digitTransformLanguage
 
string $langCode
 
string $locale
 
string $localeGroup
 
Collator $mainCollator
 
Collator $primaryCollator
 

Detailed Description

Since
1.16.3

Definition at line 21 of file IcuCollation.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Collation\IcuCollation::__construct ( LanguageFactory $languageFactory,
$locale )
Parameters
LanguageFactory$languageFactory
string$locale

Definition at line 312 of file IcuCollation.php.

References MediaWiki\Collation\IcuCollation\$locale, MediaWiki\Collation\IcuCollation\$mainCollator, and MediaWiki\Language\LanguageFactory\getLanguage().

Member Function Documentation

◆ getFirstLetter()

MediaWiki\Collation\IcuCollation::getFirstLetter ( $string)

Given a string, return the logical "first letter" to be used for grouping on category pages and so on.This has to be coordinated carefully with convertToSortkey(), or else the sorted list might jump back and forth between the same "initial letters" or other pathological behavior. For instance, if you just return the first character, but "a" sorts the same as "A" based on getSortKey(), then you might get a list like== A ==

  • [[Aardvark]]
== a ==

  • [[antelope]]
== A ==

  • [[Ape]]
etc., assuming for the sake of argument that $wgCapitalLinks is false.
Since
1.16.3
Parameters
string$stringUTF-8 string
Returns
string UTF-8 string corresponding to the first letter of input

Reimplemented from MediaWiki\Collation\Collation.

Definition at line 383 of file IcuCollation.php.

References wfMessage().

◆ getPrimarySortKey()

MediaWiki\Collation\IcuCollation::getPrimarySortKey ( string $string)
protected

Definition at line 405 of file IcuCollation.php.

Referenced by MediaWiki\Collation\PinyinCollation\getSortKey().

◆ getRawSortLetter()

MediaWiki\Collation\IcuCollation::getRawSortLetter ( string $string)
protected

Definition at line 345 of file IcuCollation.php.

Referenced by MediaWiki\Collation\PinyinCollation\getSortKey().

◆ getSortKey()

MediaWiki\Collation\IcuCollation::getSortKey ( $string)

Given a string, convert it to a (hopefully short) key that can be used for efficient sorting.A binary sort according to the sortkeys corresponds to a logical sort of the corresponding strings. Current code expects that a line feed character should sort before all others, but has no other particular expectations (and that one can be changed if necessary).

Since
1.16.3
Parameters
string$stringUTF-8 string
Returns
string Binary sortkey

Reimplemented from MediaWiki\Collation\Collation.

Reimplemented in MediaWiki\Collation\PinyinCollation.

Definition at line 341 of file IcuCollation.php.

◆ isCjk()

static MediaWiki\Collation\IcuCollation::isCjk ( $codepoint)
static

Test if a code point is a CJK (Chinese, Japanese, Korean) character.

Parameters
int$codepoint
Returns
bool
Since
1.16.3

Definition at line 558 of file IcuCollation.php.

Member Data Documentation

◆ $digitTransformLanguage

Language MediaWiki\Collation\IcuCollation::$digitTransformLanguage
protected

Definition at line 31 of file IcuCollation.php.

◆ $langCode

string MediaWiki\Collation\IcuCollation::$langCode
protected

Definition at line 27 of file IcuCollation.php.

◆ $locale

string MediaWiki\Collation\IcuCollation::$locale
protected

◆ $localeGroup

string MediaWiki\Collation\IcuCollation::$localeGroup
protected

Definition at line 29 of file IcuCollation.php.

◆ $mainCollator

Collator MediaWiki\Collation\IcuCollation::$mainCollator
protected

Definition at line 25 of file IcuCollation.php.

Referenced by MediaWiki\Collation\IcuCollation\__construct().

◆ $primaryCollator

Collator MediaWiki\Collation\IcuCollation::$primaryCollator
protected

Definition at line 24 of file IcuCollation.php.


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