mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 01:47:34 +00:00
LibJS+LibUnicode: Parse Unicode keywords from the BCP 47 CLDR package
We have a fair amount of hard-coded keywords / aliases that can now be replaced with real data from BCP 47. As a result, the also changes the awkward way we were previously generating keys. Before, we were more or less generating keywords as a CSV list of keys, e.g. for the "nu" key, we'd generate "latn,arab,grek" (ordered by locale preference). Then at runtime, we'd split on the comma. We now just generate spans of keywords directly.
This commit is contained in:
parent
d0fc61e79b
commit
89ead8c00a
6 changed files with 236 additions and 121 deletions
|
@ -153,11 +153,16 @@ Optional<Language> language_from_string(StringView language);
|
|||
Optional<Territory> territory_from_string(StringView territory);
|
||||
Optional<ScriptTag> script_tag_from_string(StringView script_tag);
|
||||
Optional<Currency> currency_from_string(StringView currency);
|
||||
Optional<CalendarName> calendar_name_from_string(StringView calendar);
|
||||
Optional<DateField> date_field_from_string(StringView calendar);
|
||||
Optional<Key> key_from_string(StringView key);
|
||||
Optional<ListPatternType> list_pattern_type_from_string(StringView list_pattern_type);
|
||||
|
||||
Optional<Key> key_from_string(StringView key);
|
||||
Optional<KeywordCalendar> keyword_ca_from_string(StringView ca);
|
||||
Optional<KeywordColCaseFirst> keyword_kf_from_string(StringView kf);
|
||||
Optional<KeywordColNumeric> keyword_kn_from_string(StringView kn);
|
||||
Optional<KeywordNumbers> keyword_nu_from_string(StringView nu);
|
||||
Vector<StringView> get_keywords_for_locale(StringView locale, StringView key);
|
||||
|
||||
Optional<DisplayPattern> get_locale_display_patterns(StringView locale);
|
||||
Optional<String> format_locale_for_display(StringView locale, LocaleID locale_id);
|
||||
|
||||
|
@ -172,8 +177,6 @@ Optional<StringView> get_locale_calendar_mapping(StringView locale, StringView c
|
|||
Optional<StringView> get_locale_long_date_field_mapping(StringView locale, StringView date_field);
|
||||
Optional<StringView> get_locale_short_date_field_mapping(StringView locale, StringView date_field);
|
||||
Optional<StringView> get_locale_narrow_date_field_mapping(StringView locale, StringView date_field);
|
||||
Optional<StringView> get_locale_key_mapping(StringView locale, StringView keyword);
|
||||
Vector<StringView> get_locale_key_mapping_list(StringView locale, StringView keyword);
|
||||
|
||||
Optional<ListPatterns> get_locale_list_patterns(StringView locale, StringView type, Style style);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue