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

5228 Коммитов

Автор SHA1 Сообщение Дата
André Bargull 4741c41fed Bug 1648137 - Part 18: Add decimal number and formatToParts support to NumberRangeFormat. r=platform-i18n-reviewers,nordzilla
These new functions match the similarily named functions on `intl::NumberFormat`.

Also add some assertions to `NumberFormat::formatToParts()` when called with
decimal number strings to ensure non-finite number strings aren't used here,
because we always pass `Nothing()` for the number in this method.

Differential Revision: https://phabricator.services.mozilla.com/D119758
2021-08-24 09:34:52 +00:00
André Bargull 777449a2c5 Bug 1648137 - Part 17: Add separate number range options struct. r=platform-i18n-reviewers,nordzilla
`NumberFormatterSkeleton::toRangeFormatter()` receives the two additional options
as extra parameters, because that's simpler to implement compared to storing the
`NumberRangeFormatOptions` struct in `NumberFormatterSkeleton`. We can revisit
this approach should `NumberRangeFormatOptions` ever get more additional options.

Differential Revision: https://phabricator.services.mozilla.com/D119757
2021-08-24 09:34:52 +00:00
André Bargull cbc4b735a9 Bug 1648137 - Part 16: Allow to format non-decimal number strings. r=platform-i18n-reviewers,dminor
Remove this Java compatibility restriction to be able to format ranges starting
resp. ending at infinity.

Differential Revision: https://phabricator.services.mozilla.com/D119756
2021-08-24 09:34:51 +00:00
André Bargull 982d8dbbbf Bug 1648137 - Part 15: Record the source of a number part. r=platform-i18n-reviewers,nordzilla
Add `NumberPartSource` to `NumberPart` in preparation for part 18.

Also changes the underlying type of `NumberPartType` to `int16_t` to ensure the
size of `NumberPart` doesn't change on 32-bit platforms when adding
`NumberPartSource`. (Note: `sizeof(NumberPart)` is 16 on 64-platforms with or
without this change.)

Differential Revision: https://phabricator.services.mozilla.com/D119755
2021-08-24 09:34:51 +00:00
André Bargull 52d6dde648 Bug 1648137 - Part 14: Make NumberPart a proper struct. r=platform-i18n-reviewers,dminor
In the next part of this patch stack, we want to record the "source" of a
number part. The source is used when formatting number ranges to record if the
formatted number part belongs to the start resp. end of the number range.

Differential Revision: https://phabricator.services.mozilla.com/D119754
2021-08-24 09:34:50 +00:00
André Bargull 59f5314db5 Bug 1648137 - Part 13: Move GetPartTypeForNumberField into NumberFormatFields.h. r=platform-i18n-reviewers,dminor
Change `GetPartTypeForNumberField` to a free function so a later part in this
patch stack can call it when processing number ranges.

Differential Revision: https://phabricator.services.mozilla.com/D119753
2021-08-24 09:34:50 +00:00
André Bargull e6e2c90a1e Bug 1648137 - Part 12: Add support for formatting number strings. r=tcampbell
The "Intl.NumberFormat v3 API" proposal adds support to format arbitrarily large
decimal numbers. For example it's now possible to format the decimal number
1e1000 by passing the string `"1e1000"` to the `format` function.

`ToIntlMathematicalValue()` preprocesses the number as follows:
- Non-finite values (NaN and infinities) are always stored as `double` values.
- Positive and negative zero are also stored as `double` values.
- Non-decimal strings like `"0x10"` are stored as BigInts, because ICU only
  supports decimal number strings.
- An error is thrown if the exponent is too large to workaround ICU limitations.

Normalising non-finite values and ±0 is done in preparation for part 17.

Differential Revision: https://phabricator.services.mozilla.com/D119752
2021-08-24 09:34:50 +00:00
André Bargull 93782a6021 Bug 1648137 - Part 9: Add support for roundingPriority option to intl::NumberFormat. r=platform-i18n-reviewers,dminor
The rounding priority names match the names in the Intl proposal.

Differential Revision: https://phabricator.services.mozilla.com/D119749
2021-08-24 09:34:49 +00:00
André Bargull e1b120bd3d Bug 1648137 - Part 7: Add support for new useGrouping value options to intl::NumberFormat. r=platform-i18n-reviewers,dminor
Change `mUseGrouping` to `mGrouping` and use an `enum` to represent the two
new additional modes "Always" and "Min2".

Differential Revision: https://phabricator.services.mozilla.com/D119747
2021-08-24 09:34:48 +00:00
André Bargull 83a11eb7f8 Bug 1648137 - Part 5: Add support for roundingIncrement, roundingMode, and trailingZeroDisplay options to intl::NumberFormat. r=platform-i18n-reviewers,dminor
First set of new options added in the "Intl.NumberFormat v3 API" proposal.

- All ICU rounding modes are added. (The Intl proposal doesn't support "HalfOdd".)
- The rounding mode names match the names in the Intl proposal, which are
  different compared to the ICU names.
- Significant digits options are ignored when rounding increment is used. This is
  an ICU limitation. The Intl proposal will throw an error if both options are
  used at the same time.

Differential Revision: https://phabricator.services.mozilla.com/D119745
2021-08-24 09:34:47 +00:00
André Bargull adf02e643c Bug 1648137 - Part 4: Fully clear the decimal quantity before assigning a new value. r=platform-i18n-reviewers,dminor
Differential Revision: https://phabricator.services.mozilla.com/D119744
2021-08-24 09:34:47 +00:00
André Bargull b921491f4b Bug 1648137 - Part 2: Add PluralRules::SelectRange(). r=dminor,platform-i18n-reviewers,nordzilla
Add `intl::NumberRangeFormat` based on the existing `intl::NumberFormat` class
and use it to implement `intl::PluralRules::SelectRange()`.

Most ICU number range formatting functions are still draft APIs and therefore
are guarded by `#ifndef U_HIDE_DRAFT_API`. Instead of requiring `mozilla::intl`
users to also use `U_HIDE_DRAFT_API`, add two additional preprocessor definitions
(`MOZ_INTL_PLURAL_RULES_HAS_SELECT_RANGE` and `MOZ_INTL_HAS_NUMBER_RANGE_FORMAT`).

When `MOZ_INTL_HAS_NUMBER_RANGE_FORMAT` isn't defined, `intl::NumberRangeFormat`
is an empty class. We could also hide the complete class if the preprocessor
guard isn't defined, but the other approach results in fewer `#ifdef` guards.

Differential Revision: https://phabricator.services.mozilla.com/D119742
2021-08-24 09:34:46 +00:00
Sandor Molnar 6721a7a44b Bug 1726570 - Fix lint failures. a-lint-fix. CLOSED TREE 2021-08-23 17:51:07 +03:00
Jonathan Kew 72e566334e Bug 1726570 - Accelerate nsFind by precomputing a const SharedBitSet for IsCombiningDiacritic. r=emilio
No user-visible change to behavior, except that searching a huge document
becomes slightly quicker.

Differential Revision: https://phabricator.services.mozilla.com/D123114
2021-08-23 14:17:54 +00:00
Zibi Braniecki 3fa745e118 Bug 1726535 - Restore the ja-JP-macos -> ja-JP-mac L10nRegistry path overload. r=platform-i18n-reviewers,jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D123133
2021-08-19 17:49:11 +00:00
André Bargull d2bbf86876 Bug 1726123 - Part 5: Add missing "js/" includes outside of SM. r=arai
In preparation for the next part, add missing includes to "js/" public headers.

Differential Revision: https://phabricator.services.mozilla.com/D122843
2021-08-17 15:45:39 +00:00
Emilio Cobos Álvarez d55d09f108 Bug 1724889 - Clean up argument conversions to avoid copies and double-work. r=zbraniecki
At least this code seems to be doing twice the work in the common case:

  https://searchfox.org/mozilla-central/rev/0fec57c05d3996cc00c55a66f20dd5793a9bfb5d/intl/l10n/Localization.cpp#439,447

Change the code to follow the more common "arrays are out-params" style,
and use in-place construction and early-returning when possible.

Depends on D122203

Differential Revision: https://phabricator.services.mozilla.com/D122204
2021-08-11 11:51:44 +00:00
Emilio Cobos Álvarez c225a14ce9 Bug 1724889 - Add missing includes and clean-up Localization.cpp. r=zbraniecki
Non-unified builds would choke on this file due to the missing includes.

Differential Revision: https://phabricator.services.mozilla.com/D122203
2021-08-11 11:51:44 +00:00
Greg Tatum 418e9b4700 Bug 1719550 - Remove nsCollation; r=platform-i18n-reviewers,nordzilla
All the call sites now use mozilla::intl::Collator

Differential Revision: https://phabricator.services.mozilla.com/D121435
2021-08-10 16:01:19 +00:00
Greg Tatum e1a87990da Bug 1719550 - Remove unused nsLocaleConstructors.h; r=platform-i18n-reviewers,nordzilla
Differential Revision: https://phabricator.services.mozilla.com/D121433
2021-08-10 16:01:18 +00:00
Greg Tatum 8f0678e0b4 Bug 1719550 - Add a TryCreateComponent to LocaleService; r=platform-i18n-reviewers,nordzilla
This method will allow mozilla::intl components to be initialized in the current
Gecko app's locale.

Differential Revision: https://phabricator.services.mozilla.com/D121428
2021-08-10 16:01:16 +00:00
Greg Tatum b41f145a38 Bug 1719550 - Add support for BCP 47 extensions to mozilla::intl::Collator; r=platform-i18n-reviewers,nordzilla
SpiderMonkey requires the BCP 47 locale extensions, which involves iterating
over the keywords in ICU, and mapping them to the BCP 47 version. Specifically,
this will change the "phonebook" keyword to "phonebk". This should hopefully
expose a simpler API to SpiderMonkey, the only consumer.

Differential Revision: https://phabricator.services.mozilla.com/D120903
2021-08-10 16:01:15 +00:00
Greg Tatum c2cf97af11 Bug 1719550 - Build an initial unified mozilla::intl::Collator; r=platform-i18n-reviewers,nordzilla
This collator attempts to match the options bag from the Intl.Collator API
from ECMA-402. It is built to be compatible and consistent across both Gecko
code and SpiderMonkey code. Its behavior is designed to match ECMA-402.

Differential Revision: https://phabricator.services.mozilla.com/D120494
2021-08-10 16:01:15 +00:00
Narcis Beleuzu daed5248e2 Backed out 12 changesets (bug 1719550) for bustages on TestCollator.cpp . CLOSED TREE
Backed out changeset 3b2735a29138 (bug 1719550)
Backed out changeset 5e2019335244 (bug 1719550)
Backed out changeset 105676dd2d6f (bug 1719550)
Backed out changeset b4b0d58778e9 (bug 1719550)
Backed out changeset 3ef5792020bb (bug 1719550)
Backed out changeset 389a77da6ddc (bug 1719550)
Backed out changeset 48f39b5ef77f (bug 1719550)
Backed out changeset bd125cc5b9b4 (bug 1719550)
Backed out changeset a8b778ca2375 (bug 1719550)
Backed out changeset b14702168fb9 (bug 1719550)
Backed out changeset 7b46b5cc7424 (bug 1719550)
Backed out changeset 6b04162618a1 (bug 1719550)
2021-08-10 17:46:34 +03:00
Greg Tatum e7657ad036 Bug 1719550 - Remove nsCollation; r=platform-i18n-reviewers,nordzilla
All the call sites now use mozilla::intl::Collator

Differential Revision: https://phabricator.services.mozilla.com/D121435
2021-08-10 11:46:38 +00:00
Greg Tatum 5fcb44e2d4 Bug 1719550 - Remove unused nsLocaleConstructors.h; r=platform-i18n-reviewers,nordzilla
Differential Revision: https://phabricator.services.mozilla.com/D121433
2021-08-10 11:46:38 +00:00
Greg Tatum 5b6db75fe7 Bug 1719550 - Add a TryCreateComponent to LocaleService; r=platform-i18n-reviewers,nordzilla
This method will allow mozilla::intl components to be initialized in the current
Gecko app's locale.

Differential Revision: https://phabricator.services.mozilla.com/D121428
2021-08-10 11:46:35 +00:00
Greg Tatum 1fb2daab2a Bug 1719550 - Add support for BCP 47 extensions to mozilla::intl::Collator; r=platform-i18n-reviewers,nordzilla
SpiderMonkey requires the BCP 47 locale extensions, which involves iterating
over the keywords in ICU, and mapping them to the BCP 47 version. Specifically,
this will change the "phonebook" keyword to "phonebk". This should hopefully
expose a simpler API to SpiderMonkey, the only consumer.

Differential Revision: https://phabricator.services.mozilla.com/D120903
2021-08-10 11:46:34 +00:00
Greg Tatum 0087d035b9 Bug 1719550 - Build an initial unified mozilla::intl::Collator; r=platform-i18n-reviewers,nordzilla
This collator attempts to match the options bag from the Intl.Collator API
from ECMA-402. It is built to be compatible and consistent across both Gecko
code and SpiderMonkey code. Its behavior is designed to match ECMA-402.

Differential Revision: https://phabricator.services.mozilla.com/D120494
2021-08-10 11:46:34 +00:00
Zibi Braniecki 04555c0e1f Bug 1723886 - Remove mozILocalization. r=platform-i18n-reviewers,gregtatum
Differential Revision: https://phabricator.services.mozilla.com/D121694
2021-08-04 15:40:29 +00:00
Zibi Braniecki 0aaa1c42b8 Bug 1723187 - Update l10nregistry-rs to handle sync-during-async overload, part2. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D121643
2021-08-03 23:44:50 +00:00
Zibi Braniecki 31f47cc980 Bug 1613705 - [localization] part10: Remove Localization.jsm. r=platform-i18n-reviewers,dminor
Depends on D113692

Differential Revision: https://phabricator.services.mozilla.com/D105586
2021-08-03 16:25:14 +00:00
Zibi Braniecki 92183f248d Bug 1613705 - [localization] part9: Update DOMLocalization to match Localization constructor. r=nika,emilio
Depends on D113691

Differential Revision: https://phabricator.services.mozilla.com/D113692
2021-08-03 16:25:13 +00:00
Zibi Braniecki 9e80b809ed Bug 1613705 - [localization] part8: Refactor SetIsSync to be SetAsync. r=platform-i18n-reviewers,dminor,emilio
Depends on D113571

Differential Revision: https://phabricator.services.mozilla.com/D113691
2021-08-03 16:25:13 +00:00
Zibi Braniecki dc735b20ee Bug 1613705 - [localization] part7: Re-enable custom locales argument to Localization. r=nika,emilio
Depends on D113570

Differential Revision: https://phabricator.services.mozilla.com/D113571
2021-08-03 16:25:12 +00:00
Zibi Braniecki 589182cc2e Bug 1613705 - [localization] part6: Fine tune error reporting to only report to automation and nightly. r=platform-i18n-reviewers,dminor
Depends on D113248

Differential Revision: https://phabricator.services.mozilla.com/D113570
2021-08-03 16:25:12 +00:00
Zibi Braniecki 2537b79bfa Bug 1613705 - [localization] part5: Refactor tests to use new API model. r=platform-i18n-reviewers,dminor
Depends on D113247

Differential Revision: https://phabricator.services.mozilla.com/D113248
2021-08-03 16:25:12 +00:00
Zibi Braniecki dec19059c5 Bug 1613705 - [localization] part4: Enable observer on Localization. r=emilio,nika
Depends on D111178

Differential Revision: https://phabricator.services.mozilla.com/D113247
2021-08-03 16:25:11 +00:00
Zibi Braniecki 879ddf9634 Bug 1613705 - [localization] part3: Introduce passing Registry to Localization to replace BundleGenerator argument. r=emilio,nika
Depends on D104789

Differential Revision: https://phabricator.services.mozilla.com/D111178
2021-08-03 16:25:11 +00:00
Zibi Braniecki 9f3aa2521f Bug 1613705 - [localization] part2: Switch Localization class to use localization-ffi. r=emilio,nika
Depends on D104788

Differential Revision: https://phabricator.services.mozilla.com/D104789
2021-08-03 16:25:10 +00:00
Zibi Braniecki 05db766a87 Bug 1613705 - [localization] part1: Introduce localization-ffi bindings for fluent-fallback. r=emilio,nika
Depends on D117349

Differential Revision: https://phabricator.services.mozilla.com/D104788
2021-08-03 16:25:10 +00:00
Butkovits Atila 949da905e7 Backed out 19 changesets (bug 1613705) for causing build bustages complaining about Document.cpp. CLOSED TREE
Backed out changeset 2ee1091dd20d (bug 1613705)
Backed out changeset d377afc0b09f (bug 1613705)
Backed out changeset de9d4378f0ac (bug 1613705)
Backed out changeset 9843372abb6e (bug 1613705)
Backed out changeset 5fc5918e5905 (bug 1613705)
Backed out changeset a7aeae7afd49 (bug 1613705)
Backed out changeset 5d61617a5402 (bug 1613705)
Backed out changeset 85bf98573899 (bug 1613705)
Backed out changeset 175af8a1b8c2 (bug 1613705)
Backed out changeset 93fcb23d7898 (bug 1613705)
Backed out changeset 595529cd906f (bug 1613705)
Backed out changeset 9f3e2963d925 (bug 1613705)
Backed out changeset 442289058933 (bug 1613705)
Backed out changeset fc3b9acb0e81 (bug 1613705)
Backed out changeset 408983c64f7f (bug 1613705)
Backed out changeset 08b637fc3fcd (bug 1613705)
Backed out changeset 6ef0aafd2db0 (bug 1613705)
Backed out changeset d88b294e0a5e (bug 1613705)
Backed out changeset e6bebff87544 (bug 1613705)
2021-08-03 12:36:01 +03:00
Zibi Braniecki 3eb02c3644 Bug 1613705 - [localization] part10: Remove Localization.jsm. r=platform-i18n-reviewers,dminor
Depends on D113692

Differential Revision: https://phabricator.services.mozilla.com/D105586
2021-08-03 05:52:03 +00:00
Zibi Braniecki 36d143e8ba Bug 1613705 - [localization] part9: Update DOMLocalization to match Localization constructor. r=nika,emilio
Depends on D113691

Differential Revision: https://phabricator.services.mozilla.com/D113692
2021-08-03 05:52:03 +00:00
Zibi Braniecki de1ee6dbf1 Bug 1613705 - [localization] part8: Refactor SetIsSync to be SetAsync. r=platform-i18n-reviewers,dminor,emilio
Depends on D113571

Differential Revision: https://phabricator.services.mozilla.com/D113691
2021-08-03 05:52:03 +00:00
Zibi Braniecki d22418d41e Bug 1613705 - [localization] part7: Re-enable custom locales argument to Localization. r=nika,emilio
Depends on D113570

Differential Revision: https://phabricator.services.mozilla.com/D113571
2021-08-03 05:52:02 +00:00
Zibi Braniecki f8df4aa5e3 Bug 1613705 - [localization] part6: Fine tune error reporting to only report to automation and nightly. r=platform-i18n-reviewers,dminor
Depends on D113248

Differential Revision: https://phabricator.services.mozilla.com/D113570
2021-08-03 05:52:02 +00:00
Zibi Braniecki 7336dd1851 Bug 1613705 - [localization] part5: Refactor tests to use new API model. r=platform-i18n-reviewers,dminor
Depends on D113247

Differential Revision: https://phabricator.services.mozilla.com/D113248
2021-08-03 05:52:01 +00:00
Zibi Braniecki 67ae94fecc Bug 1613705 - [localization] part4: Enable observer on Localization. r=emilio,nika
Depends on D111178

Differential Revision: https://phabricator.services.mozilla.com/D113247
2021-08-03 05:52:01 +00:00
Zibi Braniecki 65b2ecfd3a Bug 1613705 - [localization] part3: Introduce passing Registry to Localization to replace BundleGenerator argument. r=emilio,nika
Depends on D104789

Differential Revision: https://phabricator.services.mozilla.com/D111178
2021-08-03 05:52:01 +00:00