MediaWiki  master
NumericUppercaseCollation Class Reference

Collation that orders text with numbers "naturally", so that 'Foo 1' < 'Foo 2' < 'Foo 12'. More...

Inheritance diagram for NumericUppercaseCollation:
Collaboration diagram for NumericUppercaseCollation:

Public Member Functions

 __construct (Language $lang)
 getFirstLetter ( $string)
 getSortKey ( $string)
- Public Member Functions inherited from UppercaseCollation
 __construct ()
 getFirstLetter ( $string)
 getSortKey ( $string)
- Public Member Functions inherited from Collation
 getFirstLetter ( $string)
 Given a string, return the logical "first letter" to be used for grouping on category pages and so on. More...
 getSortKey ( $string)
 Given a string, convert it to a (hopefully short) key that can be used for efficient sorting. More...

Private Member Functions

 convertDigits ( $string)
 Convert localized digits to english digits. More...

Private Attributes


Additional Inherited Members

- Static Public Member Functions inherited from Collation
static factory ( $collationName)
static singleton ()

Detailed Description

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 35 of file NumericUppercaseCollation.php.

Constructor & Destructor Documentation

◆ __construct()

NumericUppercaseCollation::__construct ( Language  $lang)
Language$langHow 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 48 of file NumericUppercaseCollation.php.

References UppercaseCollation\$lang.

Member Function Documentation

◆ convertDigits()

NumericUppercaseCollation::convertDigits (   $string)

Convert localized digits to english digits.

based on Language::parseFormattedNumber but without commas.

string$stringsortkey to unlocalize digits of
string Sortkey with all localized digits replaced with ASCII digits.

Definition at line 82 of file NumericUppercaseCollation.php.

Referenced by getFirstLetter(), and getSortKey().

◆ getFirstLetter()

NumericUppercaseCollation::getFirstLetter (   $string)

Definition at line 94 of file NumericUppercaseCollation.php.

References convertDigits(), and wfMessage().

◆ getSortKey()

NumericUppercaseCollation::getSortKey (   $string)

Definition at line 53 of file NumericUppercaseCollation.php.

References $matches, and convertDigits().

Member Data Documentation

◆ $digitTransformLang


Definition at line 40 of file NumericUppercaseCollation.php.

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