mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 13:19:05 +00:00
LibLocale+LibJS: Port locale parsing and processing to String
In order to prevent this commit from having to refactor almost all of Intl, the goal here is to update the internal parsing/canonicalization of locales within LibLocale only. Call sites which are already equiped to handle String and OOM errors do so, however.
This commit is contained in:
parent
618714e29a
commit
ca62aeb6bd
Notes:
sideshowbarker
2024-07-17 08:35:21 +09:00
Author: https://github.com/trflynn89
Commit: ca62aeb6bd
Pull-request: https://github.com/SerenityOS/serenity/pull/17092
Reviewed-by: https://github.com/linusg
11 changed files with 371 additions and 299 deletions
|
@ -106,7 +106,7 @@ ThrowCompletionOr<Value> canonical_code_for_display_names(VM& vm, DisplayNames::
|
|||
// 1. If type is "language", then
|
||||
if (type == DisplayNames::Type::Language) {
|
||||
// a. If code does not match the unicode_language_id production, throw a RangeError exception.
|
||||
if (!::Locale::parse_unicode_language_id(code).has_value())
|
||||
if (!TRY_OR_THROW_OOM(vm, ::Locale::parse_unicode_language_id(code)).has_value())
|
||||
return vm.throw_completion<RangeError>(ErrorType::OptionIsNotValidValue, code, "language"sv);
|
||||
|
||||
// b. If IsStructurallyValidLanguageTag(code) is false, throw a RangeError exception.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue