1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 03:27:34 +00:00

LibUnicode: Parse and generate the Unicode locale list patterns dataset

This data informs consumers how to join lists of values. For example,
in en-US, the list ["a", "b", "c"] formatted to a string should become
"a, b, and c".
This commit is contained in:
Timothy Flynn 2021-09-06 13:56:44 -04:00 committed by Linus Groh
parent 9cd986d8c0
commit 3f64a14e06
4 changed files with 172 additions and 10 deletions

View file

@ -78,6 +78,13 @@ struct LocaleID {
Vector<String> private_use_extensions {};
};
struct ListPatterns {
StringView start;
StringView middle;
StringView end;
StringView pair;
};
// Note: These methods only verify that the provided strings match the EBNF grammar of the
// Unicode identifier subtag (i.e. no validation is done that the tags actually exist).
constexpr bool is_unicode_language_subtag(StringView subtag)
@ -130,6 +137,7 @@ Optional<StringView> get_locale_language_mapping(StringView locale, StringView l
Optional<StringView> get_locale_territory_mapping(StringView locale, StringView territory);
Optional<StringView> get_locale_script_mapping(StringView locale, StringView script);
Optional<StringView> get_locale_currency_mapping(StringView locale, StringView currency);
Optional<ListPatterns> get_locale_list_patterns(StringView locale, StringView type, StringView style);
Optional<StringView> resolve_language_alias(StringView language);
Optional<StringView> resolve_territory_alias(StringView territory);