@@ -56,6 +56,7 @@ struct NumberSystem {
56
56
HashMap<String, StringIndexType> symbols {};
57
57
Vector<NumberFormat> decimal_long_formats {};
58
58
Vector<NumberFormat> decimal_short_formats {};
59
+ Vector<NumberFormat> currency_short_formats {};
59
60
};
60
61
61
62
struct ListPatterns {
@@ -556,6 +557,7 @@ static void parse_number_systems(String locale_numbers_path, UnicodeLocaleData&
556
557
locale_numbers_object.as_object ().for_each_member ([&](auto const & key, JsonValue const & value) {
557
558
constexpr auto symbols_prefix = " symbols-numberSystem-" sv;
558
559
constexpr auto decimal_formats_prefix = " decimalFormats-numberSystem-" sv;
560
+ constexpr auto currency_formats_prefix = " currencyFormats-numberSystem-" sv;
559
561
560
562
if (key.starts_with (symbols_prefix)) {
561
563
auto system = key.substring (symbols_prefix.length ());
@@ -577,6 +579,14 @@ static void parse_number_systems(String locale_numbers_path, UnicodeLocaleData&
577
579
578
580
auto const & short_format = value.as_object ().get (" short" sv).as_object ().get (" decimalFormat" sv);
579
581
number_system.decimal_short_formats = parse_number_format (short_format.as_object ());
582
+ } else if (key.starts_with (currency_formats_prefix)) {
583
+ if (value.as_object ().has (" short" sv)) {
584
+ auto system = key.substring (currency_formats_prefix.length ());
585
+ auto & number_system = ensure_number_system (system);
586
+
587
+ auto const & short_format = value.as_object ().get (" short" sv).as_object ().get (" standard" sv);
588
+ number_system.currency_short_formats = parse_number_format (short_format.as_object ());
589
+ }
580
590
}
581
591
});
582
592
}
@@ -899,6 +909,7 @@ struct NumberSystem {
899
909
Array<@string_index_type@, @numeric_symbols_size@> symbols {};
900
910
Span<NumberFormat const> decimal_long_formats {};
901
911
Span<NumberFormat const> decimal_short_formats {};
912
+ Span<NumberFormat const> currency_short_formats {};
902
913
};
903
914
)~~~" );
904
915
@@ -998,6 +1009,7 @@ static constexpr Array<NumberFormat, @size@> @name@ { {
998
1009
for (auto const & number_system : number_systems) {
999
1010
append_number_formats (format_name (number_system.key , " dl" sv), number_system.value .decimal_long_formats );
1000
1011
append_number_formats (format_name (number_system.key , " ds" sv), number_system.value .decimal_short_formats );
1012
+ append_number_formats (format_name (number_system.key , " cs" sv), number_system.value .currency_short_formats );
1001
1013
}
1002
1014
1003
1015
generator.set (" name" , name);
@@ -1010,6 +1022,7 @@ static constexpr Array<NumberSystem, @size@> @name@ { {)~~~");
1010
1022
generator.set (" system" sv, String::number (number_system.value .system ));
1011
1023
generator.set (" decimal_long_formats" sv, format_name (number_system.key , " dl" sv));
1012
1024
generator.set (" decimal_short_formats" sv, format_name (number_system.key , " ds" sv));
1025
+ generator.set (" currency_short_formats" sv, format_name (number_system.key , " cs" sv));
1013
1026
generator.append (R"~~~(
1014
1027
{ @system@, {)~~~" );
1015
1028
@@ -1019,7 +1032,7 @@ static constexpr Array<NumberSystem, @size@> @name@ { {)~~~");
1019
1032
generator.append (" @index@," );
1020
1033
}
1021
1034
1022
- generator.append (" }, @decimal_long_formats@.span(), @decimal_short_formats@.span() }," );
1035
+ generator.append (" }, @decimal_long_formats@.span(), @decimal_short_formats@.span(), @currency_short_formats@.span() }," );
1023
1036
}
1024
1037
1025
1038
generator.append (R"~~~(
@@ -1401,6 +1414,9 @@ Vector<Unicode::NumberFormat> get_compact_number_system_formats(StringView local
1401
1414
case CompactNumberFormatType::DecimalShort:
1402
1415
number_formats = number_system->decimal_short_formats;
1403
1416
break;
1417
+ case CompactNumberFormatType::CurrencyShort:
1418
+ number_formats = number_system->currency_short_formats;
1419
+ break;
1404
1420
}
1405
1421
1406
1422
formats.ensure_capacity(number_formats.size());
0 commit comments