MediaWiki  master
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 }
UppercaseCollation\getFirstLetter
getFirstLetter( $string)
Given a string, return the logical "first letter" to be used for grouping on category pages and so on...
Definition: UppercaseCollation.php:43
UppercaseCollation\$lang
Language $lang
Language object for English, so we can use the generic UTF-8 uppercase function there.
Definition: UppercaseCollation.php:30
MediaWiki\Languages\LanguageFactory
Internationalisation code See https://www.mediawiki.org/wiki/Special:MyLanguage/Localisation for more...
Definition: LanguageFactory.php:42
UppercaseCollation
Definition: UppercaseCollation.php:25
Collation
Definition: Collation.php:30
MediaWiki\Languages\LanguageFactory\getLanguage
getLanguage( $code)
Get a cached or new language object for a given language code.
Definition: LanguageFactory.php:111
Language
Internationalisation code See https://www.mediawiki.org/wiki/Special:MyLanguage/Localisation for more...
Definition: Language.php:42
UppercaseCollation\__construct
__construct(LanguageFactory $languageFactory)
Definition: UppercaseCollation.php:35
UppercaseCollation\getSortKey
getSortKey( $string)
Given a string, convert it to a (hopefully short) key that can be used for efficient sorting.
Definition: UppercaseCollation.php:39