mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 06:57:45 +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:
parent
cfb9f889ac
commit
91acc2e9c5
3 changed files with 102 additions and 1 deletions
|
@ -751,6 +751,7 @@ Optional<DateField> __attribute__((weak)) date_field_from_string(StringView) { r
|
|||
Optional<Key> __attribute__((weak)) key_from_string(StringView) { return {}; }
|
||||
Optional<ListPatternType> __attribute__((weak)) list_pattern_type_from_string(StringView) { return {}; }
|
||||
Optional<ListPatternStyle> __attribute__((weak)) list_pattern_style_from_string(StringView) { return {}; }
|
||||
Optional<DisplayPattern> __attribute__((weak)) get_locale_display_patterns(StringView) { return {}; }
|
||||
Optional<StringView> __attribute__((weak)) get_locale_language_mapping(StringView, StringView) { return {}; }
|
||||
Optional<StringView> __attribute__((weak)) get_locale_territory_mapping(StringView, StringView) { return {}; }
|
||||
Optional<StringView> __attribute__((weak)) get_locale_script_mapping(StringView, StringView) { return {}; }
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue