mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 05:25:32 +03:00
LibUnicode: Add an API to retrieve a locale's default numbering system
This commit is contained in:
parent
cc5e9f0579
commit
6409900a5b
Notes:
sideshowbarker
2024-07-17 21:09:48 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/6409900a5b0 Pull-request: https://github.com/SerenityOS/serenity/pull/11813 Reviewed-by: https://github.com/linusg ✅
@ -23,6 +23,16 @@ Optional<NumberFormat> __attribute__((weak)) get_standard_number_system_format(S
|
||||
Vector<NumberFormat> __attribute__((weak)) get_compact_number_system_formats(StringView, StringView, CompactNumberFormatType) { return {}; }
|
||||
Vector<NumberFormat> __attribute__((weak)) get_unit_formats(StringView, StringView, Style) { return {}; }
|
||||
|
||||
Optional<StringView> get_default_number_system(StringView locale)
|
||||
{
|
||||
if (auto systems = get_locale_key_mapping(locale, "nu"sv); systems.has_value()) {
|
||||
auto index = systems->find(',');
|
||||
return index.has_value() ? systems->substring_view(0, *index) : *systems;
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
String replace_digits_for_number_system(StringView system, StringView number)
|
||||
{
|
||||
// https://tc39.es/ecma402/#table-numbering-system-digits
|
||||
|
@ -65,6 +65,8 @@ enum class NumericSymbol : u8 {
|
||||
PlusSign,
|
||||
};
|
||||
|
||||
Optional<StringView> get_default_number_system(StringView locale);
|
||||
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user