Produce JS-visible string results as UTF-16 at their source, including numeric formatting, BigInt and BigFraction formatting, URI encoding, console formatting, parser errors, regular expression errors, Intl and Temporal records, LibUnicode locale boundaries, and LibWeb bindings. Handle fractional radix formatting through the UTF-16 builder view.
39 lines
844 B
C++
39 lines
844 B
C++
/*
|
|
* Copyright (c) 2022-2025, Tim Flynn <trflynn89@ladybird.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/StringView.h>
|
|
#include <AK/Utf16String.h>
|
|
#include <AK/Utf16View.h>
|
|
|
|
namespace Unicode {
|
|
|
|
enum class PluralForm {
|
|
Cardinal,
|
|
Ordinal,
|
|
};
|
|
PluralForm plural_form_from_string(StringView);
|
|
PluralForm plural_form_from_string(Utf16View);
|
|
Utf16String plural_form_to_string(PluralForm);
|
|
|
|
enum class PluralCategory {
|
|
// NOTE: These are sorted in preferred order for Intl.PluralRules.prototype.resolvedOptions.
|
|
Zero,
|
|
One,
|
|
Two,
|
|
Few,
|
|
Many,
|
|
Other,
|
|
|
|
// https://unicode.org/reports/tr35/tr35-numbers.html#Explicit_0_1_rules
|
|
ExactlyZero,
|
|
ExactlyOne,
|
|
};
|
|
PluralCategory plural_category_from_string(Utf16View const&);
|
|
Utf16View plural_category_to_string(PluralCategory);
|
|
|
|
}
|