mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 23:57:34 +00:00
LibUnicode: Parse and generate compact decimal formatting rules
This commit is contained in:
parent
12b468a588
commit
604a596c90
4 changed files with 183 additions and 6 deletions
|
@ -10,6 +10,7 @@
|
|||
|
||||
namespace Unicode {
|
||||
|
||||
enum class CompactNumberFormatType : u8;
|
||||
enum class Condition : u8;
|
||||
enum class GeneralCategory : u8;
|
||||
enum class Language : u8;
|
||||
|
@ -27,6 +28,7 @@ struct LanguageID;
|
|||
struct ListPatterns;
|
||||
struct LocaleExtension;
|
||||
struct LocaleID;
|
||||
struct NumberFormat;
|
||||
struct OtherExtension;
|
||||
struct SpecialCasing;
|
||||
struct TransformedExtension;
|
||||
|
|
|
@ -812,6 +812,15 @@ Optional<StringView> get_number_system_symbol([[maybe_unused]] StringView locale
|
|||
#endif
|
||||
}
|
||||
|
||||
Vector<NumberFormat> get_compact_number_system_formats([[maybe_unused]] StringView locale, [[maybe_unused]] StringView system, [[maybe_unused]] CompactNumberFormatType type)
|
||||
{
|
||||
#if ENABLE_UNICODE_DATA
|
||||
return Detail::get_compact_number_system_formats(locale, system, type);
|
||||
#else
|
||||
return {};
|
||||
#endif
|
||||
}
|
||||
|
||||
Optional<ListPatterns> get_locale_list_patterns([[maybe_unused]] StringView locale, [[maybe_unused]] StringView type, [[maybe_unused]] StringView style)
|
||||
{
|
||||
#if ENABLE_UNICODE_DATA
|
||||
|
|
|
@ -78,6 +78,27 @@ struct LocaleID {
|
|||
Vector<String> private_use_extensions {};
|
||||
};
|
||||
|
||||
enum class CompactNumberFormatType : u8 {
|
||||
DecimalLong,
|
||||
DecimalShort,
|
||||
};
|
||||
|
||||
struct NumberFormat {
|
||||
enum class Plurality : u8 {
|
||||
Other,
|
||||
Zero,
|
||||
Single,
|
||||
One,
|
||||
Two,
|
||||
Few,
|
||||
Many,
|
||||
};
|
||||
|
||||
u8 magnitude { 0 };
|
||||
Plurality plurality { Plurality::Other };
|
||||
StringView format {};
|
||||
};
|
||||
|
||||
struct ListPatterns {
|
||||
StringView start;
|
||||
StringView middle;
|
||||
|
@ -141,6 +162,7 @@ Optional<StringView> get_locale_script_mapping(StringView locale, StringView scr
|
|||
Optional<StringView> get_locale_currency_mapping(StringView locale, StringView currency);
|
||||
Vector<StringView> get_locale_key_mapping(StringView locale, StringView keyword);
|
||||
Optional<StringView> get_number_system_symbol(StringView locale, StringView system, StringView symbol);
|
||||
Vector<NumberFormat> get_compact_number_system_formats(StringView locale, StringView system, CompactNumberFormatType type);
|
||||
Optional<ListPatterns> get_locale_list_patterns(StringView locale, StringView type, StringView style);
|
||||
|
||||
Optional<StringView> resolve_language_alias(StringView language);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue