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

5278 Коммитов

Автор SHA1 Сообщение Дата
André Bargull a5116d4ff5 Bug 1728184 - Part 1: Add a Currency class to the unified Intl API. r=platform-i18n-reviewers,dminor
Currently only provides a single method to retrieve all ISO currency codes.

The default constructor was deleted because all methods are static.

Depends on D125674

Differential Revision: https://phabricator.services.mozilla.com/D125675
2021-09-17 10:15:36 +00:00
André Bargull e50c440591 Bug 1728183 - Part 2: Add Collator::GetBcp47KeywordValues() method to retrieve all possible collations. r=platform-i18n-reviewers,dminor
In contrast to the existing `GetBcp47KeywordValuesForLocale()` method, this
method returns all possible collation types, even the ones which aren't supported
by a specific locale.

Depends on D125672

Differential Revision: https://phabricator.services.mozilla.com/D125673
2021-09-17 10:15:35 +00:00
Yoshi Cheng-Hao Huang 7ded87e9a4 Bug 1728104 - Part 4: Merge NumberFormatFieldsUtil.[cpp|h] into NumberFormatFields.[cpp|h]. r=platform-i18n-reviewers,anba,dminor
Differential Revision: https://phabricator.services.mozilla.com/D125758
2021-09-16 14:47:03 +00:00
Yoshi Cheng-Hao Huang 70b53c7640 Bug 1728104 - Part 3: Remove NumberFormatFields.h from exported headers. r=platform-i18n-reviewers,anba,dminor
Differential Revision: https://phabricator.services.mozilla.com/D125757
2021-09-16 14:47:03 +00:00
Yoshi Cheng-Hao Huang 0b48e561d6 Bug 1728104 - Part 2: Add NumberPart.h. r=platform-i18n-reviewers,anba,dminor
Differential Revision: https://phabricator.services.mozilla.com/D125684
2021-09-16 14:47:02 +00:00
Yoshi Cheng-Hao Huang 234cb720ff Bug 1728104 - Part 1: Fix non-unified build error on ListFormat.cpp. r=tcampbell
Differential Revision: https://phabricator.services.mozilla.com/D125683
2021-09-16 14:47:02 +00:00
Jonathan Kew da9c992100 Bug 1729642 - patch 1 - Make shutdown of nsLanguageAtomService explicit instead of relying on ClearOnShutdown. r=platform-i18n-reviewers,dminor
Differential Revision: https://phabricator.services.mozilla.com/D125587
2021-09-14 18:51:49 +00:00
André Bargull b8019db021 Bug 1730508 - Part 3: Enable UnusedZero and HasFreeLSB Result optimisations. r=platform-i18n-reviewers,gregtatum,dminor
Differential Revision: https://phabricator.services.mozilla.com/D125410
2021-09-14 16:10:10 +00:00
André Bargull 2ffa3169a5 Bug 1730508 - Part 2: Remove unused function NullTerminatedMapper. r=platform-i18n-reviewers,gregtatum
Differential Revision: https://phabricator.services.mozilla.com/D125409
2021-09-14 16:10:09 +00:00
André Bargull b1647a4555 Bug 1730508 - Part 1: Propagate ICUError where possible. r=platform-i18n-reviewers,gregtatum
Fully propagate `ICUError` instead of using `InternalError`.

Differential Revision: https://phabricator.services.mozilla.com/D125408
2021-09-14 16:10:09 +00:00
André Bargull 82ecb29b4c Bug 1639515 - Part 4: Update docs to point to Intl.DisplayNames. r=platform-i18n-reviewers,gregtatum
Update the documention to mention `Intl.DisplayNames` instead of
`Intl.getDisplayNames`.

Differential Revision: https://phabricator.services.mozilla.com/D76116
2021-09-14 09:20:32 +00:00
criss 59cdd2a63e Backed out 6 changesets (bug 1639515) for causing failures on test_intlUtils_getDisplayNames.html. CLOSED TREE
Backed out changeset eaff696ed6a6 (bug 1639515)
Backed out changeset 6d361f92b27e (bug 1639515)
Backed out changeset 6919213b03f7 (bug 1639515)
Backed out changeset 5a08d3b17fa7 (bug 1639515)
Backed out changeset 3681111b7ed3 (bug 1639515)
Backed out changeset 970826244d07 (bug 1639515)
2021-09-14 10:45:35 +03:00
André Bargull 252e2973ec Bug 1639515 - Part 4: Update docs to point to Intl.DisplayNames. r=platform-i18n-reviewers,gregtatum
Update the documention to mention `Intl.DisplayNames` instead of
`Intl.getDisplayNames`.

Differential Revision: https://phabricator.services.mozilla.com/D76116
2021-09-14 06:52:33 +00:00
Jonathan Kew 2535a4390c Bug 1730084 Part 6 - Add some empty fragments to the word-breaker test data. r=TYLin
Differential Revision: https://phabricator.services.mozilla.com/D125180
2021-09-13 23:55:34 +00:00
Ting-Yu Lin f8152b2b24 Bug 1730084 Part 5 - Remove WordBreaker::BreakInBetween(). r=jfkthame
The motivation of this patch is to remove rarely used API in
WordBreaker. WordBreaker::BreakInBetween() is used only in
nsFind::BreakInBetween() in production, and it can be replaced by
Next().

If the user wants to know whether there is a word break between two
strings such as the use cases in gtest, joining the two strings and
passing the result to Next() is the preferred way.

Note: I delete the buggy forward word search algorithm in
TestFindWordBreakFromPosition() because from the test expectations, it
doesn't expect to continue the search in previous fragments. Also, the
buggy part comes from the following code, which had undefined behavior
before Part 4, and does nothing after Part 4.

```
wbk->FindWord(prevFragText.get(), prevFragText.Length(), prevFragText.Length());
```

Differential Revision: https://phabricator.services.mozilla.com/D125151
2021-09-13 23:55:33 +00:00
Ting-Yu Lin bd25bca479 Bug 1730084 Part 4 - Clean up and fix an edge case of FindWord(). r=jfkthame
* Rename arguments so that their names are consistent with Next().
* Make the function not assert on an empty string, i.e. aLen == 0, like
Next().
* Fix an undefined behavior when the user passes aTextLen == aOffset.
The methods used to access `aText[aOffset]` that is clearly out of range
because the string may not be null-terminated. After this patch, it
returns a sentinel WordRange when aLen == aPos.
* Add document and gtest TestFindWordWithEmptyString().
* Change the sentinel return value to {aLen,aLen} for FindWord(), and
adapt one caller.

Differential Revision: https://phabricator.services.mozilla.com/D125434
2021-09-13 23:55:33 +00:00
Ting-Yu Lin b94f1b97c5 Bug 1730084 Part 1 - Run TestNextWordBreakWithEmptyString as a test. r=jfkthame
The function is added in Bug 1728708 Part 4, but it never get called, so
this patch transforms it into a test in WordBreak test suite to make it
run.

While I'm here, other individual functions are also transformed into
tests so that we can have more granular results if some of them failed.

Differential Revision: https://phabricator.services.mozilla.com/D125148
2021-09-13 23:55:32 +00:00
Greg Tatum b0d6525aca Bug 1719696 - Cache the original skeleton, and use it in DateIntervalFormat; r=anba,platform-i18n-reviewers,dminor
Differential Revision: https://phabricator.services.mozilla.com/D125254
2021-09-13 20:53:01 +00:00
Greg Tatum 21e515adad Bug 1719696 - Rework FillUTF8Buffer to FillBuffer; r=platform-i18n-reviewers,dminor
Differential Revision: https://phabricator.services.mozilla.com/D125252
2021-09-13 20:53:00 +00:00
Greg Tatum 8c790b7cb7 Bug 1719696 - Add ICUPointer to DateTimePatternGenerator; r=platform-i18n-reviewers,dminor
Differential Revision: https://phabricator.services.mozilla.com/D124498
2021-09-13 20:53:00 +00:00
Greg Tatum 129339b6b8 Bug 1719696 - Create a components bag abstraction for mozilla::intl::DateTimeFormat; r=anba,platform-i18n-reviewers,dminor
This patch will probably not compile on its own, but requires the SpiderMonkey
side as well. It aims at building a components bag interface that can be
then used in SpiderMonkey to back the ECMA 402 API.

Differential Revision: https://phabricator.services.mozilla.com/D123822
2021-09-13 20:52:59 +00:00
Greg Tatum b2eb7b49ba Bug 1719696 - Naively move the hour cycle computations; r=anba,platform-i18n-reviewers,dminor
This patch will not compile. It naively copies over the hour cycle code
from SpiderMonkey into the unified components. In a following patch,
these will be modified to use only the unified types.

Differential Revision: https://phabricator.services.mozilla.com/D123821
2021-09-13 20:52:59 +00:00
Greg Tatum 3971654d9f Bug 1719696 - Add a nicer assertion for checking the buffer contents; r=platform-i18n-reviewers,dminor
Differential Revision: https://phabricator.services.mozilla.com/D123820
2021-09-13 20:52:58 +00:00
Greg Tatum 7eeb5c0b59 Bug 1719696 - Use ICUError in mozilla::intl::DateTimeFormat; r=platform-i18n-reviewers,dminor
This is part of the work for Bug 1713206

Differential Revision: https://phabricator.services.mozilla.com/D123819
2021-09-13 20:52:58 +00:00
André Bargull 067c27c5ab Bug 1728182 - Part 2: Remove getLocaleInfo from toolkit. r=platform-i18n-reviewers,dminor
Depends on D125160

Differential Revision: https://phabricator.services.mozilla.com/D125163
2021-09-12 13:45:21 +00:00
Greg Tatum 238d8b17c7 Bug 1715980 - Fix the calendar keyword in Calendar::GetBcp47Type docs; r=platform-i18n-reviewers,dminor DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D124982
2021-09-09 14:57:37 +00:00
Yoshi Cheng-Hao Huang d92ecbcd8b Bug 1719747 - Part 3: ListFormat::FormatToParts takes a callback. r=gregtatum,tcampbell
As discussed in https://bugzilla.mozilla.org/show_bug.cgi?id=1719747#c6,
In Part 1, the ownership of the Span in PartsVector is maintained by
ICU. This method adds a callback so js::intl::ListFormat could copy the
content of the Span to Spidermonkey, and mozilla::intl::ListFormat could
use ScopedICUObject to release the string owned by ICU earlier.

Differential Revision: https://phabricator.services.mozilla.com/D123166
2021-09-09 12:02:22 +00:00
Yoshi Cheng-Hao Huang 39cadacc67 Bug 1719747 - Part 1: Unify ListFormat in SM. r=gregtatum,anba,platform-i18n-reviewers,tcampbell
Move implementations to mozilla::intl::ListFormat

Differential Revision: https://phabricator.services.mozilla.com/D122334
2021-09-09 12:02:21 +00:00
Greg Tatum 12c9670cc5 Bug 1713206 - Propagate ICU statuses to ICUErrors; r=platform-i18n-reviewers,dminor
Depends on D124963

Differential Revision: https://phabricator.services.mozilla.com/D124964
2021-09-08 21:36:29 +00:00
Greg Tatum 46c00b33ef Bug 1713206 - Flatten nested namespaces in mozilla::intl components; r=platform-i18n-reviewers,dminor
This is a drive-by clean-up while I'm working on errors.

Depends on D124962

Differential Revision: https://phabricator.services.mozilla.com/D124963
2021-09-08 21:36:29 +00:00
Greg Tatum e5f56207b3 Bug 1713206 - Add missing ICUError.h headers; r=platform-i18n-reviewers,dminor
Depends on D124961

Differential Revision: https://phabricator.services.mozilla.com/D124962
2021-09-08 21:36:29 +00:00
Greg Tatum 65a2bb16fc Bug 1713206 - Use ICUError in mozilla::intl::PluralRules; r=platform-i18n-reviewers,dminor
Depends on D124960

Differential Revision: https://phabricator.services.mozilla.com/D124961
2021-09-08 21:36:28 +00:00
Greg Tatum b917c44dd2 Bug 1713206 - Use ICUError in mozilla::intl::DateTimePatternGenerator; r=platform-i18n-reviewers,dminor
Depends on D124959

Differential Revision: https://phabricator.services.mozilla.com/D124960
2021-09-08 21:36:28 +00:00
Greg Tatum c5836fc86a Bug 1713206 - Use ICUError in mozilla::intl::Calendar; r=platform-i18n-reviewers,dminor
Differential Revision: https://phabricator.services.mozilla.com/D124959
2021-09-08 21:36:27 +00:00
Ting-Yu Lin 57b867e7ff Bug 1728708 Part 4 - Simplify WordBreaker::Next() and make it recognize the end of text a word break opportunity. r=jfkthame
A UAX29 compatible word breaker (like ICU4C) treat the end of text as a
word break opportunity (rule WB2 [1]), but currently lwbrk word breaker
doesn't.

The motivation of this patch is to make `WordBreaker::Next()` closer to
a UAX29 compatible one (at least for English text), and see if the
callers need to change. This should make the future integration of ICU4X
segmenter easier.

The only caller of WordBreaker::Next() is ClusterIterator's constructor.
This patch shouldn't change its behavior because we've already manually
assigned a word break point at the end of the line when `aContext` is
empty and `aDirection` is -1. This patch generalizes it to all
conditions.

Also, update TestPrintWordWithBreak() so that the result string makes
more sense.

[1] https://www.unicode.org/reports/tr29/#WB2

Differential Revision: https://phabricator.services.mozilla.com/D124304
2021-09-08 04:19:38 +00:00
Ting-Yu Lin edb9c8ed39 Bug 1728708 Part 3 - Clean up the gtest for line and word breaker. r=jfkthame
Here are the changes in this patch. They shouldn't change the behavior.

* Rename the gtest to `TestBreak.cpp` because it also contains word break tests.
* Align ruler comments to the test strings.
* Rename `lb` to `wb` in `TestASCIIWB`.
* Remove unused variable `j` in `TestPrintWordWithBreak()`.
* Use `ArrayLength` instead of `sizeof` trick to get the array length.
* #include ArrayUtils.h, and sort the #includes statements.

Differential Revision: https://phabricator.services.mozilla.com/D124303
2021-09-08 04:19:37 +00:00
Ting-Yu Lin 69a841c529 Bug 1728708 Part 2 - Rename WordBreaker::NextWord() to WordBreaker::Next(). r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D124302
2021-09-08 04:19:37 +00:00
Ting-Yu Lin 1083821003 Bug 1728708 Part 1 - Move WordBreakClass and GetClass into WordBreaker's private section. r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D124301
2021-09-08 04:19:36 +00:00
Greg Tatum 7666a8132a Bug 1719540 - Fix unified build imports bustages for mozilla::intl; r=dminor
Depends on D120249

Differential Revision: https://phabricator.services.mozilla.com/D124116
2021-09-01 00:02:31 +00:00
Greg Tatum 443160a426 Bug 1719540 - Implement a unified Locale canonicalizer; r=platform-i18n-reviewers,dminor
I used the C api here, but verified that the behavior was the same
as using the C++ getBaseName API.

927fee5656/src/features/icu.cpp (L249-L268)

I tried to keep the implementation naming at least similar to the
work in: https://phabricator.services.mozilla.com/D118070

However, the implementation do diverge. I figure in the future, the
APIs can be made similar, but at least the gtests will ensure the
behavior remains the same.

Differential Revision: https://phabricator.services.mozilla.com/D120248
2021-09-01 00:02:30 +00:00
Alexandru Michis 7be95b70ef Backed out 2 changesets (bug 1719540) for causing bustages in RelativeTimeFormat.cpp
CLOSED TREE

Backed out changeset a6ab150a89f2 (bug 1719540)
Backed out changeset e8b05f56aa75 (bug 1719540)
2021-08-31 21:14:11 +03:00
Ting-Yu Lin 5449000ecc Bug 1728241 - Fix non-unified build for intl/lwbrk. r=platform-i18n-reviewers,dminor
This patch is to fix WordBreaker.cpp under non-unified build. I test the
non-unified build locally on my Linux machine via changing
`UNIFIED_SOURCES` containing "LineBreaker.cpp" and "WordBreaker.cpp" to
`SOURCES` in intl/lwbrk/moz.build.

Differential Revision: https://phabricator.services.mozilla.com/D123999
2021-08-31 16:01:32 +00:00
Greg Tatum 1909173425 Bug 1719540 - Implement a unified Locale canonicalizer; r=platform-i18n-reviewers,dminor
I used the C api here, but verified that the behavior was the same
as using the C++ getBaseName API.

927fee5656/src/features/icu.cpp (L249-L268)

I tried to keep the implementation naming at least similar to the
work in: https://phabricator.services.mozilla.com/D118070

However, the implementation do diverge. I figure in the future, the
APIs can be made similar, but at least the gtests will ensure the
behavior remains the same.

Differential Revision: https://phabricator.services.mozilla.com/D120248
2021-08-31 15:39:39 +00:00
Dan Minor a7c1a01337 Bug 1719462 - Add intl::RelativeTimeFormat; r=platform-i18n-reviewers,gregtatum
Differential Revision: https://phabricator.services.mozilla.com/D121413
2021-08-30 19:50:20 +00:00
Dan Minor 76fa3fdc8c Bug 1719462 - Improve comments for NumberFormat::formatToParts; r=platform-i18n-reviewers,gregtatum
Differential Revision: https://phabricator.services.mozilla.com/D121412
2021-08-30 19:50:20 +00:00
Dan Minor 9ea8b755f2 Bug 1719462 - Move FormatResultToParts to NumberFormatFields; r=platform-i18n-reviewers,gregtatum
This code will be used by RelativeTimeFormat, so we need to move it to a place
where it will be accessible to both NumberFormat and RelativeTimeFormat.

Differential Revision: https://phabricator.services.mozilla.com/D121411
2021-08-30 19:50:20 +00:00
Dan Minor d8d32990af Bug 1719462 - Use ICUError in NumberFormat; r=platform-i18n-reviewers,gregtatum
Differential Revision: https://phabricator.services.mozilla.com/D121410
2021-08-30 19:50:19 +00:00
Dan Minor 962b25b43e Bug 1719462 - Add TestBuffer::clear(); r=platform-i18n-reviewers,gregtatum
This allows reusing the same buffer multiple times in a test, which
keeps test code simpler.

Differential Revision: https://phabricator.services.mozilla.com/D121409
2021-08-30 19:50:19 +00:00
Mike Hommey e3d20fb448 Bug 1727475 - Remove unused mut borrow. r=hsivonen
Differential Revision: https://phabricator.services.mozilla.com/D123592
2021-08-26 06:46:53 +00:00
Andi-Bogdan Postelnicu 2fc4f70e9b Bug 1725145 - Preparation for the hybrid build env. r=necko-reviewers,firefox-build-system-reviewers,valentin,glandium
Automatically generated path that adds flag `REQUIRES_UNIFIED_BUILD = True` to `moz.build`
when the module governed by the build config file is not buildable outside on the unified environment.

This needs to be done in order to have a hybrid build system that adds the possibility of combing
unified build components with ones that are built outside of the unified eco system.

Differential Revision: https://phabricator.services.mozilla.com/D122345
2021-08-25 10:46:17 +00:00