49 $this->digitTransformLang =
$lang;
50 parent::__construct();
54 $sortkey = parent::getSortKey( $string );
61 $sortkey = preg_replace_callback(
'/\d+/',
function (
$matches ) {
64 $len = strlen( $number );
67 $prefix = chr( floor( $len / 256 ) ) . chr( $len % 256 );
68 return '0' . $prefix . $number;
83 $table = $this->digitTransformLang->digitTransformTable();
85 $table = array_filter( $table );
86 $flipped = array_flip( $table );
88 $flipped = array_filter( $flipped,
'is_numeric' );
89 $string = strtr( $string, $flipped );
97 if ( preg_match(
'/^\d/', $convertedString ) ) {
98 return wfMessage(
'category-header-numerals' )
102 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'.
__construct(Language $lang)
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...