AbstractOperations.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * Copyright (c) 2021, Tim Flynn <trflynn89@pm.me>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/String.h>
  8. #include <AK/Variant.h>
  9. #include <AK/Vector.h>
  10. #include <LibJS/Forward.h>
  11. #include <LibJS/Runtime/Intl/DisplayNames.h>
  12. #include <LibJS/Runtime/Value.h>
  13. #include <LibUnicode/Forward.h>
  14. namespace JS::Intl {
  15. using Fallback = Variant<Empty, bool, StringView>;
  16. struct LocaleOptions {
  17. Value locale_matcher;
  18. };
  19. struct LocaleResult {
  20. String locale;
  21. };
  22. Optional<Unicode::LocaleID> is_structurally_valid_language_tag(StringView locale);
  23. String canonicalize_unicode_locale_id(Unicode::LocaleID& locale);
  24. Vector<String> canonicalize_locale_list(GlobalObject&, Value locales);
  25. Vector<String> best_fit_supported_locales(Vector<String> const& requested_locales);
  26. Vector<String> lookup_supported_locales(Vector<String> const& requested_locales);
  27. Array* supported_locales(GlobalObject&, Vector<String> const& requested_locales, Value options);
  28. Object* coerce_options_to_object(GlobalObject& global_object, Value options);
  29. Value get_option(GlobalObject& global_object, Value options, PropertyName const& property, Value::Type type, Vector<StringView> const& values, Fallback fallback);
  30. String insert_unicode_extension_and_canonicalize(Unicode::LocaleID locale_id, Unicode::LocaleExtension extension);
  31. LocaleResult resolve_locale(Vector<String> const& requested_locales, LocaleOptions const& options, Vector<StringView> relevant_extension_keys);
  32. Value canonical_code_for_display_names(GlobalObject&, DisplayNames::Type type, StringView code);
  33. }