icu_locale_core/preferences/extensions/unicode/keywords/calendar.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#![allow(non_snake_case)]
6
7#[cfg(feature = "alloc")]
8use crate::preferences::extensions::unicode::enum_keyword;
9
10#[cfg(feature = "alloc")]
11enum_keyword!(
12 /// Hijri Calendar sub-type
13 ///
14 /// The list is based on [`CLDR Calendars`](https://github.com/unicode-org/cldr/blob/main/common/bcp47/calendar.xml)
15 HijriCalendarAlgorithm {
16 /// Hijri calendar, Umm al-Qura
17 Umalqura,
18 /// Hijri calendar, tabular (intercalary years \[2,5,7,10,13,16,18,21,24,26,29] - astronomical epoch)
19 Tbla,
20 /// Hijri calendar, tabular (intercalary years \[2,5,7,10,13,16,18,21,24,26,29] - civil epoch)
21 Civil,
22 /// Hijri calendar, Saudi Arabia sighting
23 Rgsa
24});
25
26#[cfg(feature = "alloc")]
27enum_keyword!(
28 /// A Unicode Calendar Identifier defines a type of calendar.
29 ///
30 /// This selects calendar-specific data within a locale used for formatting and parsing,
31 /// such as date/time symbols and patterns; it also selects supplemental calendarData used
32 /// for calendrical calculations. The value can affect the computation of the first day of the week.
33 ///
34 /// The valid values are listed in [LDML](https://unicode.org/reports/tr35/#UnicodeCalendarIdentifier).
35 CalendarAlgorithm {
36 /// Thai Buddhist calendar (same as Gregorian except for the year)
37 ("buddhist" => Buddhist),
38 /// Traditional Chinese calendar
39 ("chinese" => Chinese),
40 /// Coptic calendar
41 ("coptic" => Coptic),
42 /// Traditional Korean calendar
43 ("dangi" => Dangi),
44 /// Ethiopic calendar, Amete Alem (epoch approx. 5493 B.C.E)
45 ("ethioaa" => Ethioaa),
46 /// Ethiopic calendar, Amete Mihret (epoch approx, 8 C.E.)
47 ("ethiopic" => Ethiopic),
48 /// Gregorian calendar
49 ("gregory" => Gregory),
50 /// Traditional Hebrew calendar
51 ("hebrew" => Hebrew),
52 /// Indian calendar
53 ("indian" => Indian),
54 /// Hijri calendar
55 ("islamic" => Hijri(HijriCalendarAlgorithm) {
56 ("umalqura" => Umalqura),
57 ("tbla" => Tbla),
58 ("civil" => Civil),
59 ("rgsa" => Rgsa)
60 }),
61 /// ISO calendar (Gregorian calendar using the ISO 8601 calendar week rules)
62 ("iso8601" => Iso8601),
63 /// Japanese Imperial calendar
64 ("japanese" => Japanese),
65 /// Persian calendar
66 ("persian" => Persian),
67 /// Republic of China calendar
68 ("roc" => Roc)
69}, "ca", s, if *s == value!("islamicc") { return Ok(Self::Hijri(Some(HijriCalendarAlgorithm::Civil))); });