|
MediaWiki master
|
Collation that orders text with numbers "naturally", so that 'Foo 1' < 'Foo 2' < 'Foo 12'. More...
Inherits MediaWiki\Collation\UppercaseCollation.
Inherited by MediaWiki\Collation\CustomUppercaseCollation.

Public Member Functions | ||||
| __construct (LanguageFactory $languageFactory, $digitTransformLang) | ||||
| 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 ==
| ||||
| 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).
| ||||
Public Member Functions inherited from MediaWiki\Collation\UppercaseCollation | ||||
| __construct (LanguageFactory $languageFactory) | ||||
Public Member Functions inherited from MediaWiki\Collation\Collation | ||||
| getSortKeys ( $strings) | ||||
| Get multiple sort keys. | ||||
Collation that orders text with numbers "naturally", so that 'Foo 1' < 'Foo 2' < 'Foo 12'.
Note that this only works in terms of sequences of digits, and the behavior for decimal fractions or pretty-formatted numbers may be unexpected.
Digits will be based on the wiki's content language settings. If you change the content language of a wiki you will need to run updateCollation.php –force. Only English (ASCII 0-9) and the localized version will be counted. Localized digits from other languages or weird unicode digit equivalents (e.g. 4, 𝟜, ⓸ , ⁴, etc) will not count.
Definition at line 26 of file NumericUppercaseCollation.php.
| MediaWiki\Collation\NumericUppercaseCollation::__construct | ( | LanguageFactory | $languageFactory, |
| $digitTransformLang ) |
| LanguageFactory | $languageFactory | |
| string | Language | $digitTransformLang | How to convert digits. For example, if given language "my" than ၇ is treated like 7. It is expected that usually this is given the content language. |
Definition at line 39 of file NumericUppercaseCollation.php.
| MediaWiki\Collation\NumericUppercaseCollation::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 ==
| string | $string | UTF-8 string |
Reimplemented from MediaWiki\Collation\UppercaseCollation.
Reimplemented in MediaWiki\Collation\CustomUppercaseCollation.
Definition at line 92 of file NumericUppercaseCollation.php.
References wfMessage().
| MediaWiki\Collation\NumericUppercaseCollation::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 MediaWiki\Collation\UppercaseCollation.
Reimplemented in MediaWiki\Collation\CustomUppercaseCollation.
Definition at line 50 of file NumericUppercaseCollation.php.
References $matches.