icu_locale_core/preferences/extensions/unicode/keywords/
collation.rs

1// This file is part of ICU4X. For terms of use, please see the file
2// called LICENSE at the top level of the ICU4X source tree
3// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ).
4
5#[cfg(feature = "alloc")]
6use crate::preferences::extensions::unicode::enum_keyword;
7
8#[cfg(feature = "alloc")]
9enum_keyword!(
10    /// A Unicode Collation Identifier defines a type of collation (sort order).
11    ///
12    /// The valid values are listed in [LDML](https://unicode.org/reports/tr35/#UnicodeCollationIdentifier).
13    CollationType {
14        /// A previous version of the ordering, for compatibility
15        ("compat" => Compat),
16        /// Dictionary style ordering (such as in Sinhala)
17        ("dict" => Dict),
18        /// The default Unicode collation element table order
19        ("ducet" => Ducet),
20        /// Recommended ordering for emoji characters
21        ("emoji" => Emoji),
22        /// European ordering rules
23        ("eor" => Eor),
24        /// Phonebook style ordering (such as in German)
25        ("phonebk" => Phonebk),
26        /// Phonetic ordering (sorting based on pronunciation)
27        ("phonetic" => Phonetic),
28        /// Pinyin ordering for Latin and for CJK characters (used in Chinese)
29        ("pinyin" => Pinyin),
30        /// Special collation type for string search
31        ("search" => Search),
32        /// Special collation type for Korean initial consonant search
33        ("searchjl" => Searchjl),
34        /// Default ordering for each language
35        ("standard" => Standard),
36        /// Pinyin ordering for Latin, stroke order for CJK characters (used in Chinese)
37        ("stroke" => Stroke),
38        /// Traditional style ordering (such as in Spanish)
39        ("trad" => Trad),
40        /// Pinyin ordering for Latin, Unihan radical-stroke ordering for CJK characters (used in Chinese)
41        ("unihan" => Unihan),
42        /// Pinyin ordering for Latin, zhuyin order for Bopomofo and CJK characters (used in Chinese)
43        ("zhuyin" => Zhuyin),
44}, "co");
45
46#[cfg(feature = "alloc")]
47enum_keyword!(
48    /// Collation parameter key for ordering by case.
49    ///
50    /// If set to upper, causes upper case to sort before lower case. If set to lower, causes lower case to sort before upper case.
51    /// Useful for locales that have already supported ordering but require different order of cases. Affects case and tertiary levels.
52    ///
53    /// The defails see [LDML](https://unicode.org/reports/tr35/tr35-collation.html#Case_Parameters).
54    [Default]
55    CollationCaseFirst {
56        /// Upper case to be sorted before lower case
57        ("upper" => Upper),
58        /// Lower case to be sorted before upper case
59        ("lower" => Lower),
60        /// No special case ordering
61        [default]
62        ("false" => False),
63}, "kf");
64
65#[cfg(feature = "alloc")]
66enum_keyword!(
67    /// Collation parameter key for numeric handling.
68    ///
69    /// If set to on, any sequence of Decimal Digits (General_Category = Nd in the UAX44) is sorted at a primary level with
70    /// its numeric value. For example, "1" < "2" < "10". The computed primary weights are all at the start of the digit
71    /// reordering group.
72    [Default]
73    CollationNumericOrdering {
74        /// A sequence of decimal digits is sorted at primary level with its numeric value
75        ("true" => True),
76        /// No special handling for numeric ordering
77        [default]
78        ("false" => False),
79}, "kn");