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