mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
LibUnicode: Generate per-locale data for the "noon" fixed day period
Note that not all locales have this day period.
This commit is contained in:
parent
16b673eaa9
commit
32c07bc6c3
Notes:
sideshowbarker
2024-07-17 08:40:31 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/32c07bc6c3 Pull-request: https://github.com/SerenityOS/serenity/pull/14637 Reviewed-by: https://github.com/linusg ✅
2 changed files with 7 additions and 1 deletions
|
@ -590,6 +590,8 @@ static Optional<Unicode::DayPeriod> day_period_from_string(StringView day_period
|
|||
return Unicode::DayPeriod::AM;
|
||||
if (day_period == "pm"sv)
|
||||
return Unicode::DayPeriod::PM;
|
||||
if (day_period == "noon"sv)
|
||||
return Unicode::DayPeriod::Noon;
|
||||
if (day_period == "morning1"sv)
|
||||
return Unicode::DayPeriod::Morning1;
|
||||
if (day_period == "morning2"sv)
|
||||
|
@ -1364,7 +1366,7 @@ static void parse_calendar_symbols(Calendar& calendar, JsonObject const& calenda
|
|||
auto const& narrow_symbols = symbols_object.get("narrow"sv).as_object();
|
||||
auto const& short_symbols = symbols_object.get("abbreviated"sv).as_object();
|
||||
auto const& long_symbols = symbols_object.get("wide"sv).as_object();
|
||||
auto symbol_lists = create_symbol_lists(10);
|
||||
auto symbol_lists = create_symbol_lists(11);
|
||||
|
||||
auto append_symbol = [&](auto& symbols, auto const& key, auto symbol) {
|
||||
if (auto day_period = day_period_from_string(key); day_period.has_value())
|
||||
|
@ -1613,6 +1615,9 @@ static ErrorOr<void> parse_day_periods(String core_path, UnicodeLocaleData& loca
|
|||
};
|
||||
|
||||
auto parse_day_period = [&](auto const& symbol, auto const& ranges) -> Optional<DayPeriod> {
|
||||
if (!ranges.has("_from"sv))
|
||||
return {};
|
||||
|
||||
auto day_period = day_period_from_string(symbol);
|
||||
if (!day_period.has_value())
|
||||
return {};
|
||||
|
|
|
@ -50,6 +50,7 @@ enum class Weekday : u8 {
|
|||
enum class DayPeriod : u8 {
|
||||
AM,
|
||||
PM,
|
||||
Noon,
|
||||
Morning1,
|
||||
Morning2,
|
||||
Afternoon1,
|
||||
|
|
Loading…
Reference in a new issue