mirror of
https://github.com/RGBCube/serenity
synced 2025-05-17 01:15:07 +00:00

Note that only option type=region is really implemented. Other types will resort to the fallback option. This prototype method will be able to implement other type options once LibUnicode supports more.
33 lines
943 B
C++
33 lines
943 B
C++
/*
|
|
* Copyright (c) 2021, Tim Flynn <trflynn89@pm.me>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/String.h>
|
|
#include <AK/Variant.h>
|
|
#include <AK/Vector.h>
|
|
#include <LibJS/Forward.h>
|
|
#include <LibJS/Runtime/Intl/DisplayNames.h>
|
|
#include <LibJS/Runtime/Value.h>
|
|
|
|
namespace JS::Intl {
|
|
|
|
using Fallback = Variant<Empty, bool, StringView>;
|
|
|
|
struct LocaleOptions {
|
|
Value locale_matcher;
|
|
};
|
|
|
|
struct LocaleResult {
|
|
String locale;
|
|
};
|
|
|
|
Vector<String> canonicalize_locale_list(GlobalObject&, Value locales);
|
|
Value get_option(GlobalObject& global_object, Value options, PropertyName const& property, Value::Type type, Vector<StringView> const& values, Fallback fallback);
|
|
LocaleResult resolve_locale(Vector<String> const& requested_locales, LocaleOptions const& options, Vector<StringView> relevant_extension_keys);
|
|
Value canonical_code_for_display_names(GlobalObject&, DisplayNames::Type type, StringView code);
|
|
|
|
}
|