This adds a FormatDateTime method that takes a skeleton as an argument and
returns the localized date and time according to the skeleton. In the future,
we'll add an overload that allows taking an DateTimeOptions property bag, but
for now, this will provide enough functionality to allow us to remove the
kDateFormatYearMonth and kDateFormatYearMonthLong selectors as well as the code
for handling skeletons from FormatPRExplodedTime.
Differential Revision: https://phabricator.services.mozilla.com/D93012
This renames kTimeFormatSeconds to kTimeFormatLong and kTimeFormatNoSeconds to
kTimeFormatShort. This is consistent with the naming used for date format
selectors.
Differential Revision: https://phabricator.services.mozilla.com/D93011
The formatters in mFormatCache are only valid for the locale in which they were
created. Currently the tests change mLocale directly but leave the cache in
place which can lead to incorrect test results depending upon which tests are
executed. This is not a problem outside of the tests because mLocale is normally
only set once during the call to Initialize() which will not change the current
locale once it is set.
Differential Revision: https://phabricator.services.mozilla.com/D93009
This adds a method to get the calendar symbol for a month or a weekday in long
or short form. We'll add more fields and styles in the future, the current patch
provides enough functionality to replace the selectors for kDateFormatMonthLong
and kDateFormatWeekday, which are currently used to retrieve display names by
calling FormatPRExplodedTime.
Differential Revision: https://phabricator.services.mozilla.com/D93008
This backs out all work from bug 1627075 as well as all of its
descendents. There were a few conflicts when backing this out but
overall it was pretty clean, so I would say it's a fairly mild
level of risk. Historically Nathan Froyd has reviewed these patches,
but he is no longer at Mozilla, and no one else is particularly
familiar with the code, so I am passing this off to RyanVM who has
at least been familiar with the history of the bug.
Differential Revision: https://phabricator.services.mozilla.com/D90096
This patch was generated by running:
```
perl -p -i \
-e 's/^(\s+)([a-zA-Z0-9.]+) = NS_ConvertUTF8toUTF16\((.*)\);/\1CopyUTF8toUTF16(\3, \2);/;' \
-e 's/^(\s+)([a-zA-Z0-9.]+) = NS_ConvertUTF16toUTF8\((.*)\);/\1CopyUTF16toUTF8(\3, \2);/;' \
$FILE
```
against every .cpp and .h in mozilla-central, and then fixing up the
inevitable errors that happen as a result of matching C++ expressions with
regexes. The errors fell into three categories:
1. Calling the convert functions with `std::string::c_str()`; these were
changed to simply pass the string instead, relying on implicit conversion
to `mozilla::Span`.
2. Calling the convert functions with raw pointers, which is not permitted
with the copy functions; these were changed to invoke `MakeStringSpan` first.
3. Other miscellaneous errors resulting from over-eager regexes and/or the
replacement not being type-aware. These changes were reverted.
Differential Revision: https://phabricator.services.mozilla.com/D88903
As said in llvm coding standard else should not be used after interrupts statements.
It is my first time contribution for open source.
Differential Revision: https://phabricator.services.mozilla.com/D82743
Handle numbering systems similar to measurement units:
- Add a central list of all supported numbering systems in a yaml file.
- Verify these numbering systems are supported by ICU.
- Also verify ICU supports no additional simple numbering systems. (ECMA-402
should support all numbering systems with simple digit mappings defined in
CLDR.)
- Generate source and test files from this list of numbering systems.
Differential Revision: https://phabricator.services.mozilla.com/D81717