mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-12 20:42:21 +00:00
LibJS+LibLocale: Replace plural rules selection with ICU
This uses ICU for all of the Intl.PluralRules prototypes, which lets us remove all data from our plural rules generator. Plural rules depend directly on internal data from the number formatter, so rather than creating a separate Locale::PluralRules class (which will make accessing that data awkward), this adds plural rules APIs to the existing Locale::NumberFormat.
This commit is contained in:
parent
7f9ccd39f5
commit
5e2ee4447e
Notes:
sideshowbarker
2024-07-16 23:38:54 +09:00
Author: https://github.com/trflynn89
Commit: 5e2ee4447e
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/170
14 changed files with 216 additions and 1026 deletions
|
@ -6,7 +6,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <LibJS/Runtime/Completion.h>
|
||||
#include <LibJS/Runtime/Intl/NumberFormat.h>
|
||||
|
@ -32,15 +31,7 @@ private:
|
|||
::Locale::PluralForm m_type { ::Locale::PluralForm::Cardinal }; // [[Type]]
|
||||
};
|
||||
|
||||
struct ResolvedPlurality {
|
||||
::Locale::PluralCategory plural_category; // [[PluralCategory]]
|
||||
String formatted_string; // [[FormattedString]]
|
||||
};
|
||||
|
||||
::Locale::PluralOperands get_operands(StringView string);
|
||||
::Locale::PluralCategory plural_rule_select(StringView locale, ::Locale::PluralForm type, Value number, ::Locale::PluralOperands operands);
|
||||
ResolvedPlurality resolve_plural(PluralRules const&, Value number);
|
||||
::Locale::PluralCategory plural_rule_select_range(StringView locale, ::Locale::PluralForm, ::Locale::PluralCategory start, ::Locale::PluralCategory end);
|
||||
::Locale::PluralCategory resolve_plural(PluralRules const&, Value number);
|
||||
ThrowCompletionOr<::Locale::PluralCategory> resolve_plural_range(VM&, PluralRules const&, Value start, Value end);
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue