Граф коммитов

31 Коммитов

Автор SHA1 Сообщение Дата
Erik Nordin 0990d59463 Bug 1719758 - Test result values before unwrapping in TestPluralRules r=platform-i18n-reviewers,dminor
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
2021-07-09 17:49:38 +00:00
Greg Tatum 8c72f6e6ae Bug 1715979 - Do not leak ICU objects in mozilla:intl component moves; r=nordzilla
Differential Revision: https://phabricator.services.mozilla.com/D117569
2021-06-29 15:25:44 +00:00
Erik Nordin ed5c7b4262 Bug 1718345 - Add PluralRules tests for three-letter langids r=platform-i18n-reviewers,dminor
Differential Revision: https://phabricator.services.mozilla.com/D118869
2021-06-28 16:24:03 +00:00
André Bargull 90a85eee9f Bug 1284868: Adjust field widths for hour/minute/second when the user requested 2-digit representation. r=dminor
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
2021-06-28 13:20:44 +00:00
Dan Minor eeaf61de24 Bug 1715982 - Fix initial capacity of NumberPartVector; r=anba
Differential Revision: https://phabricator.services.mozilla.com/D117540
2021-06-11 21:22:15 +00:00
Greg Tatum 07cc89dd24 Bug 1711902 - Add Calendar::GetCanonicalTimeZoneID; r=dminor
This finishes the UCalendar unification in DateTimeFormat.cpp

Differential Revision: https://phabricator.services.mozilla.com/D116158
2021-06-10 20:14:17 +00:00
Greg Tatum db78fe91b5 Bug 1711902 - Unify most of UCalendar in SpiderMonkey; r=dminor,anba
This adds a bigger unification primitive of an Enumeration iterator over the
UEnumeration ICU type.

Differential Revision: https://phabricator.services.mozilla.com/D116157
2021-06-10 20:14:17 +00:00
Greg Tatum 23873163d1 Bug 1711902 - Unify the DateTimePatternGenerator in SpiderMonkey; r=dminor,anba
Differential Revision: https://phabricator.services.mozilla.com/D115731
2021-06-10 20:14:17 +00:00
Greg Tatum cb9860735f Bug 1711902 - Remove UDateFormat from SpiderMonkey; r=dminor,anba
This patch starts the work of unifying the DateTimeFormat. It removes the uses
of UDateFormat.

Differential Revision: https://phabricator.services.mozilla.com/D115730
2021-06-10 20:14:16 +00:00
Greg Tatum efe295fd94 Bug 1711902 - Add a FormatBuffer for use in SpiderMonkey; r=anba
Differential Revision: https://phabricator.services.mozilla.com/D116911
2021-06-10 20:14:16 +00:00
Erik Nordin 875656873e Bug 1704509 - Add Unified PuralRules Impl For SpiderMonkey r=anba,dminor
- Adds mozilla::intl::PluralRules
    - Modifies SpiderMonkey code to use PluralRules.
    - Adds gtest suite for PluralRules

Differential Revision: https://phabricator.services.mozilla.com/D115783
2021-06-09 19:04:54 +00:00
Greg Tatum bf5ee6077d Bug 1705156 - Add a unified DateTimeFormat component; r=dminor,anba
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
2021-05-27 23:03:43 +00:00
Dan Minor 0452666d00 Bug 1701695 - Add NumberFormat::TryCreate; r=tcampbell
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
2021-05-12 17:22:51 +00:00
Dan Minor 3b533cd007 Bug 1701695 - Add documentation to NumberFormat.h; r=gregtatum,nordzilla
Differential Revision: https://phabricator.services.mozilla.com/D113145
2021-05-12 17:22:51 +00:00
Dan Minor 5f755ac1ab Bug 1701695 - Use intl::NumberFormatterSkeleton in PluralRules r=tcampbell
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
2021-05-12 17:22:50 +00:00
Dan Minor d5183e8bf1 Bug 1701695 - Add support for format to parts to intl::NumberFormat r=gregtatum,tcampbell,anba
Differential Revision: https://phabricator.services.mozilla.com/D111886
2021-05-12 17:22:49 +00:00
Dan Minor 4b3bf83c4b Bug 1701695 - Restore [[nodiscard]] annotations to NumberFormatterSkeleton; r=gregtatum
I foolishly dropped these when bringing the code over from SpiderMonkey.

Differential Revision: https://phabricator.services.mozilla.com/D113558
2021-05-12 17:22:49 +00:00
Dan Minor afc8a3b58a Bug 1701695 - Rename NumberFormatOptions::CurrencyDisplayStyle; r=gregtatum
This should be CurrencyDisplay to be consistent with ecma-402.

Differential Revision: https://phabricator.services.mozilla.com/D113557
2021-05-12 17:22:48 +00:00
Dan Minor 27dd93eb84 Bug 1701695 - Return std::u16string_view instead of char16_t* in intl::NumberFormat r=gregtatum
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
2021-05-12 17:22:48 +00:00
Brindusan Cristian efd8dfd0cf Backed out 9 changesets (bug 1701695) for causing xpcshell failures in test_messagecontext.js. CLOSED TREE
Backed out changeset e88dd41c0a90 (bug 1701695)
Backed out changeset 823ed70ef5fe (bug 1701695)
Backed out changeset 11f97bc74622 (bug 1701695)
Backed out changeset fdf12ac55593 (bug 1701695)
Backed out changeset abcf774d3b58 (bug 1701695)
Backed out changeset 4239fe67d69f (bug 1701695)
Backed out changeset 216472b634b9 (bug 1701695)
Backed out changeset 89ff5f91d8e9 (bug 1701695)
Backed out changeset 9c0dbc73dad2 (bug 1701695)
2021-05-11 15:25:46 +03:00
Dan Minor 7a648a32c3 Bug 1701695 - Add NumberFormat::TryCreate; r=tcampbell
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
2021-05-11 11:37:40 +00:00
Dan Minor 6eaea879f1 Bug 1701695 - Add documentation to NumberFormat.h; r=gregtatum,nordzilla
Differential Revision: https://phabricator.services.mozilla.com/D113145
2021-05-11 11:37:40 +00:00
Dan Minor 3322d3ceb6 Bug 1701695 - Use intl::NumberFormatterSkeleton in PluralRules r=tcampbell
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
2021-05-11 11:37:38 +00:00
Dan Minor c6f5bbceb4 Bug 1701695 - Add support for format to parts to intl::NumberFormat r=gregtatum,tcampbell,anba
Differential Revision: https://phabricator.services.mozilla.com/D111886
2021-05-11 11:37:38 +00:00
Dan Minor 8cf0f1089a Bug 1701695 - Restore [[nodiscard]] annotations to NumberFormatterSkeleton; r=gregtatum
I foolishly dropped these when bringing the code over from SpiderMonkey.

Differential Revision: https://phabricator.services.mozilla.com/D113558
2021-05-11 11:37:38 +00:00
Dan Minor 72adfe7239 Bug 1701695 - Rename NumberFormatOptions::CurrencyDisplayStyle; r=gregtatum
This should be CurrencyDisplay to be consistent with ecma-402.

Differential Revision: https://phabricator.services.mozilla.com/D113557
2021-05-11 11:37:37 +00:00
Dan Minor 089ad0d14c Bug 1701695 - Return std::u16string_view instead of char16_t* in intl::NumberFormat r=gregtatum
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
2021-05-11 11:37:37 +00:00
Dan Minor 28196b0645 Bug 1705363 - Fixes to intl::NumberFormatterSkeleton; r=gregtatum
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
2021-04-20 18:16:24 +00:00
Dan Minor 96711bfb68 Bug 1695937 - Add intl::NumberFormat to components; r=zbraniecki,tcampbell,jandem
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
2021-04-08 14:56:33 +00:00
Butkovits Atila 15db4c5343 Backed out 2 changesets (bug 1695937) for causing bustages on FluentBundle.cpp.
Backed out changeset d17059c999a6 (bug 1695937)
Backed out changeset 232a570d6739 (bug 1695937)
2021-04-08 04:21:27 +03:00
Dan Minor 91e357191b Bug 1695937 - Add intl::NumberFormat to components; r=zbraniecki,tcampbell,jandem
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
2021-04-07 20:03:22 +00:00