1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 23:28:11 +00:00

LibJS+LibUnicode: Move replacement of number system digits to LibUnicode

There are a few algorithms in TR-35 that need to replace digits before
returning any results to callers. For example, when formatting time zone
offsets, a string like "GMT+12:34" must have its digits replaced with
the default numbering system for the desired locale.
This commit is contained in:
Timothy Flynn 2022-01-11 10:07:45 -05:00 committed by Linus Groh
parent 5aa144193c
commit cc5e9f0579
3 changed files with 98 additions and 93 deletions

View file

@ -67,9 +67,12 @@ enum class NumericSymbol : u8 {
Optional<StringView> get_number_system_symbol(StringView locale, StringView system, NumericSymbol symbol);
Optional<NumberGroupings> get_number_system_groupings(StringView locale, StringView system);
String replace_digits_for_number_system(StringView system, StringView number);
Optional<NumberFormat> get_standard_number_system_format(StringView locale, StringView system, StandardNumberFormatType type);
Vector<NumberFormat> get_compact_number_system_formats(StringView locale, StringView system, CompactNumberFormatType type);
Vector<NumberFormat> get_unit_formats(StringView locale, StringView unit, Style style);
Optional<NumberFormat> select_pattern_with_plurality(Vector<NumberFormat> const& formats, double number);
Optional<String> augment_currency_format_pattern(StringView currency_display, StringView base_pattern);