LibJS: Remove hard-coded lists of collation types

Working around not having collation data in the CLDR now handled in the
Unicode generators.
This commit is contained in:
Timothy Flynn 2022-07-14 18:09:10 -04:00 committed by Andreas Kling
parent f8f7015419
commit c657f23e6f
2 changed files with 2 additions and 5 deletions

View file

@ -120,9 +120,7 @@ JS_DEFINE_NATIVE_FUNCTION(Intl::supported_values_of)
// 3. Else if key is "collation", then // 3. Else if key is "collation", then
else if (key == "collation"sv) { else if (key == "collation"sv) {
// a. Let list be ! AvailableCollations( ). // a. Let list be ! AvailableCollations( ).
// FIXME: We don't yet parse any collation data, but "default" is allowed. This matches Intl.Locale.prototype.collations. list = Unicode::get_available_collation_types();
static constexpr auto collations = AK::Array { "default"sv };
list = collations.span();
} }
// 4. Else if key is "currency", then // 4. Else if key is "currency", then
else if (key == "currency"sv) { else if (key == "currency"sv) {

View file

@ -103,8 +103,7 @@ Array* collations_of_locale(GlobalObject& global_object, Locale const& locale_ob
VERIFY(Unicode::parse_unicode_locale_id(locale).has_value()); VERIFY(Unicode::parse_unicode_locale_id(locale).has_value());
// 4. Let list be a List of 1 or more unique canonical collation identifiers, which must be lower case String values conforming to the type sequence from UTS 35 Unicode Locale Identifier, section 3.2, sorted in descending preference of those in common use for string comparison in locale. The values "standard" and "search" must be excluded from list. // 4. Let list be a List of 1 or more unique canonical collation identifiers, which must be lower case String values conforming to the type sequence from UTS 35 Unicode Locale Identifier, section 3.2, sorted in descending preference of those in common use for string comparison in locale. The values "standard" and "search" must be excluded from list.
// FIXME: Retrieve this data from the CLDR when we fully support collation. This matches Intl.supportedValuesOf. auto list = Unicode::get_keywords_for_locale(locale, "co"sv);
Vector<StringView> list { "default"sv };
// 5. Return ! CreateArrayFromListOrRestricted( list, restricted ). // 5. Return ! CreateArrayFromListOrRestricted( list, restricted ).
return create_array_from_list_or_restricted(global_object, move(list), move(restricted)); return create_array_from_list_or_restricted(global_object, move(list), move(restricted));