57 parent::__construct( $languageFactory );
61 $sortkey = parent::getSortKey( $string );
68 $sortkey = preg_replace_callback(
'/\d+/',
static function (
$matches ) {
71 $len = strlen( $number );
74 $prefix = chr( floor( $len / 256 ) ) . chr( $len % 256 );
75 return '0' . $prefix . $number;
90 $table = $this->digitTransformLang->digitTransformTable();
92 $table = array_filter( $table );
93 $flipped = array_flip( $table );
95 $flipped = array_filter( $flipped,
'is_numeric' );
96 $string = strtr( $string, $flipped );
104 if ( preg_match(
'/^\d/', $convertedString ) ) {
105 return wfMessage(
'category-header-numerals' )
109 return parent::getFirstLetter( $string );
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
Internationalisation code See https://www.mediawiki.org/wiki/Special:MyLanguage/Localisation for more...
Collation that orders text with numbers "naturally", so that 'Foo 1' < 'Foo 2' < 'Foo 12'.
Language $digitTransformLang
How to convert digits (usually the content language)
convertDigits( $string)
Convert localized digits to english digits.
getSortKey( $string)
Given a string, convert it to a (hopefully short) key that can be used for efficient sorting.
getFirstLetter( $string)
Given a string, return the logical "first letter" to be used for grouping on category pages and so on...
__construct(LanguageFactory $languageFactory, $digitTransformLang)