MediaWiki REL1_37
|
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. | |
getFirstLetterCount () | |
getFirstLetterData () | |
getLetterByIndex ( $index) | |
getPrimarySortKey ( $string) | |
getSortKey ( $string) | |
Given a string, convert it to a (hopefully short) key that can be used for efficient sorting. | |
getSortKeyByLetterIndex ( $index) | |
Static Public Member Functions | |
static | getUnicodeVersionForICU () |
Return the version of Unicode appropriate for the version of ICU library currently in use, or false when it can't be determined. | |
static | isCjk ( $codepoint) |
Test if a code point is a CJK (Chinese, Japanese, Korean) character. | |
Static Public Member Functions inherited from Collation | |
static | factory ( $collationName) |
static | singleton () |
Protected Attributes | |
Language | $digitTransformLanguage |
Private Member Functions | |
fetchFirstLetterData () | |
getPrecompiledData ( $name) | |
Get an object from the precompiled serialized directory. | |
Private Attributes | |
array | $firstLetterData |
string | $locale |
Collator | $mainCollator |
Collator | $primaryCollator |
bool | $useNumericCollation = false |
const | CJK_BLOCKS |
Unified CJK blocks. | |
const | FIRST_LETTER_VERSION = 4 |
const | TAILORING_FIRST_LETTERS |
Additional characters (or character groups) to be considered separate letters for given languages, or to be removed from the list of such letters (denoted by keys starting with '-'). | |
Definition at line 26 of file IcuCollation.php.
IcuCollation::__construct | ( | LanguageFactory | $languageFactory, |
$locale | |||
) |
LanguageFactory | $languageFactory | |
string | $locale |
Definition at line 248 of file IcuCollation.php.
References $locale, and MediaWiki\Languages\LanguageFactory\getLanguage().
|
private |
MWException |
Definition at line 350 of file IcuCollation.php.
References $IP, getPrecompiledData(), getPrimarySortKey(), and wfDebug().
Referenced by getFirstLetterData().
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 ==
== a ==
== A ==
etc., assuming for the sake of argument that $wgCapitalLinks is false.
string | $string | UTF-8 string |
Reimplemented from Collation.
Definition at line 283 of file IcuCollation.php.
References getFirstLetterCount(), getLetterByIndex(), getPrimarySortKey(), and wfMessage().
IcuCollation::getFirstLetterCount | ( | ) |
Definition at line 529 of file IcuCollation.php.
References getFirstLetterData().
Referenced by getFirstLetter().
IcuCollation::getFirstLetterData | ( | ) |
Definition at line 328 of file IcuCollation.php.
References $cache, $firstLetterData, CACHE_ANYTHING, and fetchFirstLetterData().
Referenced by getFirstLetterCount(), getLetterByIndex(), and getSortKeyByLetterIndex().
IcuCollation::getLetterByIndex | ( | $index | ) |
string | $index |
Definition at line 512 of file IcuCollation.php.
References getFirstLetterData().
Referenced by getFirstLetter().
|
private |
Get an object from the precompiled serialized directory.
Replaced use of wfGetPrecompiledData
string | $name |
Definition at line 495 of file IcuCollation.php.
References $blob, $file, $IP, and unserialize().
Referenced by fetchFirstLetterData().
IcuCollation::getPrimarySortKey | ( | $string | ) |
Definition at line 279 of file IcuCollation.php.
Referenced by fetchFirstLetterData(), and getFirstLetter().
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).
string | $string | UTF-8 string |
Reimplemented from Collation.
Definition at line 275 of file IcuCollation.php.
IcuCollation::getSortKeyByLetterIndex | ( | $index | ) |
string | $index |
Definition at line 521 of file IcuCollation.php.
References getFirstLetterData().
|
static |
Return the version of Unicode appropriate for the version of ICU library currently in use, or false when it can't be determined.
Definition at line 555 of file IcuCollation.php.
Referenced by GenerateCollationData\execute().
|
static |
Test if a code point is a CJK (Chinese, Japanese, Korean) character.
int | $codepoint |
Definition at line 539 of file IcuCollation.php.
Referenced by GenerateCollationData\charCallback().
|
protected |
Definition at line 39 of file IcuCollation.php.
|
private |
Definition at line 45 of file IcuCollation.php.
Referenced by getFirstLetterData().
|
private |
Definition at line 36 of file IcuCollation.php.
Referenced by __construct().
|
private |
Definition at line 33 of file IcuCollation.php.
|
private |
Definition at line 30 of file IcuCollation.php.
|
private |
Definition at line 42 of file IcuCollation.php.
|
private |
Unified CJK blocks.
The same definition of a CJK block must be used for both Collation and generateCollationData.php. These blocks are omitted from the first letter data, as an optimisation measure and because the default UCA table is pretty useless for sorting Chinese text anyway. Japanese and Korean blocks are not included here, because they are smaller and more useful.
Definition at line 56 of file IcuCollation.php.
|
private |
Definition at line 27 of file IcuCollation.php.
|
private |
Additional characters (or character groups) to be considered separate letters for given languages, or to be removed from the list of such letters (denoted by keys starting with '-').
These are additions to (or subtractions from) the data stored in the first-letters-root.php data file (which among others includes full basic Latin, Cyrillic and Greek alphabets).
"Separate letter" is a letter that would have a separate heading/section for it in a dictionary or a phone book in this language. This data isn't used for sorting (the ICU library handles that), only for deciding which characters (or character groups) to use as headings.
Initially generated based on the primary level of Unicode collation tailorings available at http://developer.mimer.com/charts/tailorings.htm , later modified.
Empty arrays are intended; this signifies that the data for the language is available and that there are, in fact, no additional letters to consider.
Definition at line 95 of file IcuCollation.php.