MediaWiki
REL1_31
CollationFa.php
Go to the documentation of this file.
1
<?php
31
class
CollationFa
extends
IcuCollation
{
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
}
CollationFa
Temporary workaround for incorrect collation of Persian language ('fa') in ICU 52 (bug T139110).
Definition
CollationFa.php:31
CollationFa\getFirstLetter
getFirstLetter( $string)
Given a string, return the logical "first letter" to be used for grouping on category pages and so on...
Definition
CollationFa.php:54
CollationFa\__construct
__construct()
Definition
CollationFa.php:45
CollationFa\$override
$override
Definition
CollationFa.php:34
CollationFa\getSortKey
getSortKey( $string)
Given a string, convert it to a (hopefully short) key that can be used for efficient sorting.
Definition
CollationFa.php:49
IcuCollation
Definition
IcuCollation.php:24
includes
collation
CollationFa.php
Generated on Mon Nov 25 2024 15:34:37 for MediaWiki by
1.10.0