MediaWiki  REL1_31
CollationFa Class Reference

Temporary workaround for incorrect collation of Persian language ('fa') in ICU 52 (bug T139110). More...

Inheritance diagram for CollationFa:
Collaboration diagram for CollationFa:

Public Member Functions

 __construct ()
 
 getFirstLetter ( $string)
 Given a string, return the logical "first letter" to be used for grouping on category pages and so on. More...
 
 getSortKey ( $string)
 Given a string, convert it to a (hopefully short) key that can be used for efficient sorting. More...
 
- Public Member Functions inherited from IcuCollation
 __construct ( $locale)
 
 getFirstLetterCount ()
 
 getFirstLetterData ()
 
 getLetterByIndex ( $index)
 
 getPrimarySortKey ( $string)
 
 getSortKeyByLetterIndex ( $index)
 

Private Attributes

 $override
 

Additional Inherited Members

- Static Public Member Functions inherited from IcuCollation
static getICUVersion ()
 Return the version of ICU library used by PHP's intl extension, or false when the extension is not installed of the version can't be determined. More...
 
static getUnicodeVersionForICU ()
 Return the version of Unicode appropriate for the version of ICU library currently in use, or false when it can't be determined. More...
 
static isCjk ( $codepoint)
 Test if a code point is a CJK (Chinese, Japanese, Korean) character. More...
 
- Static Public Member Functions inherited from Collation
static factory ( $collationName)
 
static singleton ()
 
- Public Attributes inherited from IcuCollation
const FIRST_LETTER_VERSION = 3
 
const RECORD_LENGTH = 14
 
- Protected Attributes inherited from IcuCollation
Language $digitTransformLanguage
 

Detailed Description

Temporary workaround for incorrect collation of Persian language ('fa') in ICU 52 (bug T139110).

Replace with other letters that appear in an okish spot in the alphabet

  • Characters 'و' 'ا' (often appear at the beginning of words)
  • Characters 'ٲ' 'ٳ' (may appear at the beginning of words in loanwords)
Since
1.29

Definition at line 31 of file CollationFa.php.

Constructor & Destructor Documentation

◆ __construct()

CollationFa::__construct ( )

Definition at line 45 of file CollationFa.php.

Member Function Documentation

◆ getFirstLetter()

CollationFa::getFirstLetter (   $string)

Given a string, return the logical "first letter" to be used for grouping on category pages and so on.

This has to be coordinated carefully with convertToSortkey(), or else the sorted list might jump back and forth between the same "initial letters" or other pathological behavior. For instance, if you just return the first character, but "a" sorts the same as "A" based on getSortKey(), then you might get a list like

== A ==

  • [[Aardvark]]

== a ==

  • [[antelope]]

== A ==

  • [[Ape]]

etc., assuming for the sake of argument that $wgCapitalLinks is false.

Since
1.16.3
Parameters
string$stringUTF-8 string
Returns
string UTF-8 string corresponding to the first letter of input

Reimplemented from IcuCollation.

Definition at line 54 of file CollationFa.php.

◆ getSortKey()

CollationFa::getSortKey (   $string)

Given a string, convert it to a (hopefully short) key that can be used for efficient sorting.

A binary sort according to the sortkeys corresponds to a logical sort of the corresponding strings. Current code expects that a line feed character should sort before all others, but has no other particular expectations (and that one can be changed if necessary).

Since
1.16.3
Parameters
string$stringUTF-8 string
Returns
string Binary sortkey

Reimplemented from IcuCollation.

Definition at line 49 of file CollationFa.php.

Member Data Documentation

◆ $override

CollationFa::$override
private
Initial value:
= [
"\xd8\xa7" => "\xd8\xa3",
"\xd9\x88" => "\xd9\x89",
"\xd9\xb2" => "\xF3\xB3\x80\x81",
"\xd9\xb3" => "\xF3\xB3\x80\x82",
]

Definition at line 34 of file CollationFa.php.


The documentation for this class was generated from the following file: