1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 18:18:12 +00:00

LibUnicode: Generate era, month, weekday and day period calendar symbols

The parsing in parse_calendar_symbols() might be a bit more verbose than
it really needs to be, but it is to ensure the symbols are generated in
a known order that we can control with enumerations.
This commit is contained in:
Timothy Flynn 2021-12-06 12:22:39 -05:00 committed by Linus Groh
parent 26f9666191
commit 2bbf8aa24c
3 changed files with 355 additions and 6 deletions

View file

@ -15,6 +15,45 @@
namespace Unicode {
enum class Era : u8 {
BC,
AD,
};
enum class Month : u8 {
January,
February,
March,
April,
May,
June,
July,
August,
September,
October,
November,
December,
};
enum class Weekday : u8 {
Sunday,
Monday,
Tuesday,
Wednesday,
Thursday,
Friday,
Saturday,
};
enum class DayPeriod : u8 {
AM,
PM,
Morning,
Afternoon,
Evening,
Night,
};
enum class HourCycle : u8 {
H11,
H12,
@ -99,5 +138,9 @@ Vector<Unicode::HourCycle> get_regional_hour_cycles(StringView locale);
Optional<Unicode::HourCycle> get_default_regional_hour_cycle(StringView locale);
Optional<CalendarFormat> get_calendar_format(StringView locale, StringView calendar, CalendarFormatType type);
Vector<CalendarPattern> get_calendar_available_formats(StringView locale, StringView calendar);
Optional<StringView> get_calendar_era_symbol(StringView locale, StringView calendar, CalendarPatternStyle style, Unicode::Era value);
Optional<StringView> get_calendar_month_symbol(StringView locale, StringView calendar, CalendarPatternStyle style, Unicode::Month value);
Optional<StringView> get_calendar_weekday_symbol(StringView locale, StringView calendar, CalendarPatternStyle style, Unicode::Weekday value);
Optional<StringView> get_calendar_day_period_symbol(StringView locale, StringView calendar, CalendarPatternStyle style, Unicode::DayPeriod value);
}