Modifies TestPluralRules.cpp to assert that all result values are okay
before unwrapping them. Previously the test suite would crash if an
error result was unwrapped. Now it will fail the test and report the
failure.
Differential Revision: https://phabricator.services.mozilla.com/D119465
Change `DateTimePatternGenerator::GetBestPattern()` to call `udatpg_getBestPatternWithOptions()`,
so we can adjust the computed pattern to use 2-digit representation when it was requested by the
user.
Differential Revision: https://phabricator.services.mozilla.com/D118728
This patch adds a DateTimeFormat class for use in the unified
internationalization API. Currently it's only targeting the
ICU code in the Fluent API. The plan is to use it in the Fluent DOM
code, as well as in SpiderMonkey as a centralized API for performing
datetime formatting.
Differential Revision: https://phabricator.services.mozilla.com/D114114
This adds a fallible factory method to create new NumberFormat instances. This
allows us to report initialization errors at time of initialization, rather than
when format is called, and remove internal checks in the implementation for
successful initialization.
The existing fluent code assumes that creating a NumberFormat instance always
succeeds. This patch updates that code to handle failures.
Differential Revision: https://phabricator.services.mozilla.com/D114593
This temporarily adds intl::NumberFormatterSkeleton to the public API so that
we can use it in PluralRules. This allows us to remove the SpiderMonkey
NumberFormatterSkeleton implementation when we convert SpiderMonkey to use
intl::NumberFormat.
We can remove intl::NumberFormatterSkeleton from the public API when we
implement intl::PluralRules in Bug 1704509.
Differential Revision: https://phabricator.services.mozilla.com/D111887
The SpiderMonkey call sites need both the pointer and the length when
copying/deflating the string, so this changes the API to expose the underlying
string_view.
While we're here, this updates the API to use mozilla::Result.
Differential Revision: https://phabricator.services.mozilla.com/D112801
This adds a fallible factory method to create new NumberFormat instances. This
allows us to report initialization errors at time of initialization, rather than
when format is called, and remove internal checks in the implementation for
successful initialization.
The existing fluent code assumes that creating a NumberFormat instance always
succeeds. This patch updates that code to handle failures.
Differential Revision: https://phabricator.services.mozilla.com/D114593
This temporarily adds intl::NumberFormatterSkeleton to the public API so that
we can use it in PluralRules. This allows us to remove the SpiderMonkey
NumberFormatterSkeleton implementation when we convert SpiderMonkey to use
intl::NumberFormat.
We can remove intl::NumberFormatterSkeleton from the public API when we
implement intl::PluralRules in Bug 1704509.
Differential Revision: https://phabricator.services.mozilla.com/D111887
The SpiderMonkey call sites need both the pointer and the length when
copying/deflating the string, so this changes the API to expose the underlying
string_view.
While we're here, this updates the API to use mozilla::Result.
Differential Revision: https://phabricator.services.mozilla.com/D112801
These are fixes for issues noticed with NumberFormatterSkeleton while testing
this code in SpiderMonkey against the full set of intl tests there. I've added
minimal test cases for the issues encountered as part of this patch.
Differential Revision: https://phabricator.services.mozilla.com/D112240
This adds an initial version of NumberFormat that is suitable for use by
Fluent.
The options formatting code is taken from SpiderMonkey and modified to use the
standard c++ library rather than SpiderMonkey specific code. The code
generated MeasureUnitGenerated.h is duplicated here temporarily. Once we can
move SpiderMonkey to using this code, we can update the code generation to
avoid this duplication.
Some simple gtests have been written to make development easier. Full test
coverage is not a goal here, as this code will eventually be covered by running
test262 in SpiderMonkey.
Differential Revision: https://phabricator.services.mozilla.com/D107223
This adds an initial version of NumberFormat that is suitable for use by
Fluent.
The options formatting code is taken from SpiderMonkey and modified to use the
standard c++ library rather than SpiderMonkey specific code. The code
generated MeasureUnitGenerated.h is duplicated here temporarily. Once we can
move SpiderMonkey to using this code, we can update the code generation to
avoid this duplication.
Some simple gtests have been written to make development easier. Full test
coverage is not a goal here, as this code will eventually be covered by running
test262 in SpiderMonkey.
Differential Revision: https://phabricator.services.mozilla.com/D107223