MediaWiki REL1_37
UppercaseCollation.php
Go to the documentation of this file.
1<?php
24
26
30 private $lang;
31
35 public function __construct( LanguageFactory $languageFactory ) {
36 $this->lang = $languageFactory->getLanguage( 'en' );
37 }
38
39 public function getSortKey( $string ) {
40 return $this->lang->uc( $string );
41 }
42
43 public function getFirstLetter( $string ) {
44 if ( $string[0] == "\0" ) {
45 $string = substr( $string, 1 );
46 }
47 return $this->lang->ucfirst( $this->lang->firstChar( $string ) );
48 }
49
50}
Internationalisation code See https://www.mediawiki.org/wiki/Special:MyLanguage/Localisation for more...
Definition Language.php:42
Internationalisation code See https://www.mediawiki.org/wiki/Special:MyLanguage/Localisation for more...
getLanguage( $code)
Get a cached or new language object for a given language code.
__construct(LanguageFactory $languageFactory)
getFirstLetter( $string)
Given a string, return the logical "first letter" to be used for grouping on category pages and so on...
getSortKey( $string)
Given a string, convert it to a (hopefully short) key that can be used for efficient sorting.
Language $lang
Language object for English, so we can use the generic UTF-8 uppercase function there.