MediaWiki REL1_31
CollationFa.php
Go to the documentation of this file.
1<?php
32
33 // Really hacky - replace with stuff from other blocks.
34 private $override = [
35 // U+0627 ARABIC LETTER ALEF => U+0623 ARABIC LETTER ALEF WITH HAMZA ABOVE
36 "\xd8\xa7" => "\xd8\xa3",
37 // U+0648 ARABIC LETTER WAW => U+0649 ARABIC LETTER ALEF MAKSURA
38 "\xd9\x88" => "\xd9\x89",
39 // U+0672 ARABIC LETTER ALEF WITH WAVY HAMZA ABOVE => U+F3001 (private use area)
40 "\xd9\xb2" => "\xF3\xB3\x80\x81",
41 // U+0673 ARABIC LETTER ALEF WITH WAVY HAMZA BELOW => U+F3002 (private use area)
42 "\xd9\xb3" => "\xF3\xB3\x80\x82",
43 ];
44
45 public function __construct() {
46 parent::__construct( 'fa' );
47 }
48
49 public function getSortKey( $string ) {
50 $modified = strtr( $string, $this->override );
51 return parent::getSortKey( $modified );
52 }
53
54 public function getFirstLetter( $string ) {
55 if ( isset( $this->override[substr( $string, 0, 2 )] ) ) {
56 return substr( $string, 0, 2 );
57 }
58 return parent::getFirstLetter( $string );
59 }
60}
Temporary workaround for incorrect collation of Persian language ('fa') in ICU 52 (bug T139110).
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.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition injection.txt:37