summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibUnicode
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2022-02-15 14:51:48 -0500
committerTim Flynn <trflynn89@pm.me>2022-02-16 07:23:07 -0500
commit63c34372744f9f47c09ff9f92db1ba388451e6dd (patch)
tree5e7b678049e670c0300cf27aa18c19ab9387380a /Userland/Libraries/LibUnicode
parent89ead8c00a7c25aca8ab0022f09babcea9485bc2 (diff)
downloadserenity-63c34372744f9f47c09ff9f92db1ba388451e6dd.zip
LibUnicode: Use BCP 47 data to generate available calendars and numbers
BCP 47 will be the single source of truth for known calendar and number system keywords, and their aliases (e.g. "gregory" is an alias for "gregorian"). Move the generation of available keywords to where we parse the BCP 47 data, so that hard-coded aliases may be removed from other generators.
Diffstat (limited to 'Userland/Libraries/LibUnicode')
-rw-r--r--Userland/Libraries/LibUnicode/DateTimeFormat.cpp1
-rw-r--r--Userland/Libraries/LibUnicode/DateTimeFormat.h2
-rw-r--r--Userland/Libraries/LibUnicode/Locale.cpp2
-rw-r--r--Userland/Libraries/LibUnicode/Locale.h3
-rw-r--r--Userland/Libraries/LibUnicode/NumberFormat.cpp1
-rw-r--r--Userland/Libraries/LibUnicode/NumberFormat.h2
6 files changed, 5 insertions, 6 deletions
diff --git a/Userland/Libraries/LibUnicode/DateTimeFormat.cpp b/Userland/Libraries/LibUnicode/DateTimeFormat.cpp
index dda00c4a0f..6ec47d101d 100644
--- a/Userland/Libraries/LibUnicode/DateTimeFormat.cpp
+++ b/Userland/Libraries/LibUnicode/DateTimeFormat.cpp
@@ -93,7 +93,6 @@ StringView calendar_pattern_style_to_string(CalendarPatternStyle style)
Optional<Calendar> __attribute__((weak)) calendar_from_string(StringView) { return {}; }
Optional<HourCycleRegion> __attribute__((weak)) hour_cycle_region_from_string(StringView) { return {}; }
-Span<StringView const> __attribute__((weak)) get_available_calendars() { return {}; }
Vector<HourCycle> __attribute__((weak)) get_regional_hour_cycles(StringView) { return {}; }
// https://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
diff --git a/Userland/Libraries/LibUnicode/DateTimeFormat.h b/Userland/Libraries/LibUnicode/DateTimeFormat.h
index 1badc16219..92343fa5ef 100644
--- a/Userland/Libraries/LibUnicode/DateTimeFormat.h
+++ b/Userland/Libraries/LibUnicode/DateTimeFormat.h
@@ -189,8 +189,6 @@ StringView calendar_pattern_style_to_string(CalendarPatternStyle style);
Optional<Calendar> calendar_from_string(StringView calendar);
Optional<HourCycleRegion> hour_cycle_region_from_string(StringView hour_cycle_region);
-Span<StringView const> get_available_calendars();
-
Vector<HourCycle> get_regional_hour_cycles(StringView region);
Vector<Unicode::HourCycle> get_locale_hour_cycles(StringView locale);
Optional<Unicode::HourCycle> get_default_regional_hour_cycle(StringView locale);
diff --git a/Userland/Libraries/LibUnicode/Locale.cpp b/Userland/Libraries/LibUnicode/Locale.cpp
index 71b7c11912..a9e9ba3e8b 100644
--- a/Userland/Libraries/LibUnicode/Locale.cpp
+++ b/Userland/Libraries/LibUnicode/Locale.cpp
@@ -766,6 +766,8 @@ StringView style_to_string(Style style)
}
}
+Span<StringView const> __attribute__((weak)) get_available_calendars() { return {}; }
+Span<StringView const> __attribute__((weak)) get_available_number_systems() { return {}; }
Optional<Locale> __attribute__((weak)) locale_from_string(StringView) { return {}; }
Optional<Language> __attribute__((weak)) language_from_string(StringView) { return {}; }
Optional<Territory> __attribute__((weak)) territory_from_string(StringView) { return {}; }
diff --git a/Userland/Libraries/LibUnicode/Locale.h b/Userland/Libraries/LibUnicode/Locale.h
index 18f66ba17d..e25d7ddb54 100644
--- a/Userland/Libraries/LibUnicode/Locale.h
+++ b/Userland/Libraries/LibUnicode/Locale.h
@@ -145,6 +145,9 @@ Optional<String> canonicalize_unicode_locale_id(LocaleID&);
String const& default_locale();
bool is_locale_available(StringView locale);
+Span<StringView const> get_available_calendars();
+Span<StringView const> get_available_number_systems();
+
Style style_from_string(StringView style);
StringView style_to_string(Style style);
diff --git a/Userland/Libraries/LibUnicode/NumberFormat.cpp b/Userland/Libraries/LibUnicode/NumberFormat.cpp
index e9cbc2a4b4..13b5199000 100644
--- a/Userland/Libraries/LibUnicode/NumberFormat.cpp
+++ b/Userland/Libraries/LibUnicode/NumberFormat.cpp
@@ -16,7 +16,6 @@
namespace Unicode {
-Span<StringView const> __attribute__((weak)) get_available_number_systems() { return {}; }
Optional<NumberSystem> __attribute__((weak)) number_system_from_string(StringView) { return {}; }
Optional<StringView> __attribute__((weak)) get_number_system_symbol(StringView, StringView, NumericSymbol) { return {}; }
Optional<NumberGroupings> __attribute__((weak)) get_number_system_groupings(StringView, StringView) { return {}; }
diff --git a/Userland/Libraries/LibUnicode/NumberFormat.h b/Userland/Libraries/LibUnicode/NumberFormat.h
index 1407516f68..96670cd78e 100644
--- a/Userland/Libraries/LibUnicode/NumberFormat.h
+++ b/Userland/Libraries/LibUnicode/NumberFormat.h
@@ -66,8 +66,6 @@ enum class NumericSymbol : u8 {
PlusSign,
};
-Span<StringView const> get_available_number_systems();
-
Optional<NumberSystem> number_system_from_string(StringView system);
Optional<StringView> get_default_number_system(StringView locale);