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

LibUnicode: Parse and generate locale display patterns

These patterns indicate how to display locale strings when that locale
contains multiple subtags. For example, "en-US" would be displayed as
"English (United States)".
This commit is contained in:
Timothy Flynn 2022-01-13 13:10:24 -05:00 committed by Linus Groh
parent cfb9f889ac
commit 91acc2e9c5
3 changed files with 102 additions and 1 deletions

View file

@ -85,6 +85,11 @@ enum class Style : u8 {
Numeric,
};
struct DisplayPattern {
StringView locale_pattern;
StringView locale_separator;
};
struct ListPatterns {
StringView start;
StringView middle;
@ -152,6 +157,8 @@ Optional<Key> key_from_string(StringView key);
Optional<ListPatternType> list_pattern_type_from_string(StringView list_pattern_type);
Optional<ListPatternStyle> list_pattern_style_from_string(StringView list_pattern_style);
Optional<DisplayPattern> get_locale_display_patterns(StringView locale);
Optional<StringView> get_locale_language_mapping(StringView locale, StringView language);
Optional<StringView> get_locale_territory_mapping(StringView locale, StringView territory);
Optional<StringView> get_locale_script_mapping(StringView locale, StringView script);