Internationalization Module User’s Guide : Chapter 6 Collation : Customizing a Collator : Examining Collation Levels
Examining Collation Levels
RWUCollator provides methods for controlling how weights at the various collation levels are examined.
Collation Strength
The setStrength() method determines the number of collation strength levels taken into consideration by RWUCollator. For example, setting a collator’s strength to RWUCollator::Primary causes it to ignore secondary and tertiary differences in collation weights, in effect ignoring diacritical and case differences.
Quaternary strength is useful only in two situations:
When punctuation shifting is enabled (“Punctuation Shifting”), whitespace and punctuation characters are ignored at the first three strength levels, and are distinguished at the quaternary level.
For Japanese locales, hiragana characters are positioned before katakana characters at the quaternary level, mimicking JIS sort order.
The default strength level for most locales is tertiary; for Japanese, it is quaternary.
The getStrength() method returns the current collation strength associated with the collator.
Case Level
The enableCaseLevel() method creates an additional level of collation information, known as the case level, that distinguishes between characters just on their case. Lower-case letters, small kana, and uncased characters are distinguished from upper-case letters, which are in turn distinguished from mixed-case digraphs such the Croation Lj. If the case level is enabled, case distinctions are made regardless of the collator's strength level. This behavior is disabled by default.
The isEnabledCaseLevel() method returns true if the case level is enabled; otherwise, false.
French Collation
The enableFrenchCollation() method determines the order in which secondary weights are compared. Normally, weights at all levels are compared from the start of the input strings to their ends. When French collation is enabled, secondary weights are compared in reverse order, from the end of the input strings to their beginnings, as is customary in French. French collation is enabled by default for French locales.
The isEnabledFrenchCollation() method returns true if the French collation is enabled; otherwise, false.