mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 20:28:11 +00:00
LibLocale+LibJS+ClockSettings: Make date time format APIs infallible
These APIs only perform small allocations, and are only used by LibJS and the time zone settings widget. Callers which could only have failed from these APIs are also made to be infallible here.
This commit is contained in:
parent
0914e86691
commit
7536648498
9 changed files with 183 additions and 191 deletions
|
@ -1680,7 +1680,7 @@ Optional<StringView> get_preferred_keyword_value_for_locale(StringView locale, S
|
|||
// FIXME: Calendar keywords are also region-based, and will need to be handled here when we support non-Gregorian calendars:
|
||||
// https://github.com/unicode-org/cldr-json/blob/main/cldr-json/cldr-core/supplemental/calendarPreferenceData.json
|
||||
if (key == "hc"sv) {
|
||||
auto hour_cycles = MUST(get_locale_hour_cycles(locale));
|
||||
auto hour_cycles = get_locale_hour_cycles(locale);
|
||||
if (hour_cycles.is_empty())
|
||||
return OptionalNone {};
|
||||
|
||||
|
@ -1709,7 +1709,7 @@ Vector<StringView> get_keywords_for_locale(StringView locale, StringView key)
|
|||
// FIXME: Calendar keywords are also region-based, and will need to be handled here when we support non-Gregorian calendars:
|
||||
// https://github.com/unicode-org/cldr-json/blob/main/cldr-json/cldr-core/supplemental/calendarPreferenceData.json
|
||||
if (key == "hc"sv) {
|
||||
auto hour_cycles = MUST(get_locale_hour_cycles(locale));
|
||||
auto hour_cycles = get_locale_hour_cycles(locale);
|
||||
|
||||
Vector<StringView> values;
|
||||
values.ensure_capacity(hour_cycles.size());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue