Skip to content

v60.1.0-alpha.402

Pre-release
Pre-release
Compare
Choose a tag to compare
@NightOwl888 NightOwl888 released this 02 Apr 15:42
· 38 commits to main since this release
1545efb

Known Issues

  1. The ICU4N.FormatNumberRuleBased uses the .NET formatter and replaces the ASCII digit output with native digits of the current language. This formatter doesn't support all of the features of DecimalFormat. Once known issue with it is that it doesn't follow the "half even" or "round toward even" rounding as is in the IEEE 754 specfication. See TR35#Rounding. Instead it rounds "toward positive infinity". To our knowledge, this only affects behavior of floating point numbers when they are larger than the value of Int64.MaxValue (9,223,372,036,854,775,807; that is, hexadecimal 0x7FFFFFFFFFFFFFFF) or smaller than Int64.MinValue (negative 9,223,372,036,854,775,808; that is, hexadecimal 0x8000000000000000), however, there may be other cases where rounding is incorrect when plural formatting is part of the rule.

Change Log

Breaking Changes

  1. ICU4N.Impl.ResourceKey::Substring(): Converted from start/end to startIndex/length to match .NET conventions. Optimized to use ValueStringBuilder, where Span<T> is supported.
  2. ICU4N.Impl.PluralRulesLoader + ICU4N.Text.PluralRules: Renamed ForLocale() > GetInstance() to match .NET naming conventions.
  3. ICU4N.Text.NumberPresentation: Moved NumberPresentation enum and NumberPresentationExtensions class from the ICU4N.Text to ICU4N.Globalization namespace. Changed the values to start with 0 instead of 1 so we have a reasonable default value in .NET.
  4. ICU4N.Globalization.UCultureInfo: Removed ClearCachedData() method. This is in .NET only to allow it to fetch culture settings that have changed in the underlying OS.
  5. ICU4N.Text (DisplayContext + DisplayContextType + DisplayContextExtensions): Removed from the public API since they had been previously refactored in the ICU4N.Globalization namespace as Capitalization, DialectHandling, DisplayLength, and SubstituteHandling enums and the DisplayContextOptions class.
  6. ICU4N.Text (NumberFormat + DecimalFormat + RuleBasedNumberFormat): Removed from the public API and added an IncludeLegacyNumberFormat build property so they can be optionally compiled for those who need these features. The plan is to port the remaining frunctionality that isn't already covered by FormatNumberRuleBased into static APIs later.
  7. ICU4N.Globalization.Capitalization: Added "For" prefix to the names as they were in ICU4J, since this adds clarity to their intended purpose. Also explicitly specified numeric values of Capitalization, DialectHandling, DisplayLength, and SubstituteHandling enums in ICU4N.Globalization to match ICU4J numeric values.

New Features

1.ICU4N.Impl.PatternProps: Added WhiteSpace static field with the same values that are matched with PatternProps.IsWhiteSpace() for use in Trim() method overloads.
8. Added new FormatNumberRuleBased static class to act as the new API for the ICU4J RuleBasedNumberFormat functionality. This API consists of extension methods for the numeric data types:

  1. ICU4N.Globalization: Added NumberFormatRules class to serve as the rules engine for the Rule-based Number Format functionality. This class is immutable and thread safe. Optimized Rule-based Number Format rule description string parsing to eliminate unnecessary substring allocations.
  2. ICU4N.Text (SplitTokenizerEnumerator + MultiDelimiterSplitTokenizerEnumerator): Added features to control delimiter length to exclude from the token and trim behavior for start/end/both (or specify no trimChars for no trimming)
  3. ICU4N.Globalization: Added UNumberFormatInfo class to cover the .NET NumberFormatInfo API. This class can be instantiated and used in the same way as the .NET API.
  4. ICU4N.Globalization.UNumberFormatInfo: Added SpellOut, Ordinal, Duration, and NumberingSystem properties to expose the rules engines and DefaultRuleSetName and RuleSetNames properties publicly. These can be used to deterimine the ruleSetName to pass to the FormatNumberRuleBased APIs.
  5. ICU4N.Globalization.UNumberFormatInfo: Added Capitalization property (DisplayContext enum in ICU4J).
  6. ICU4N: Added IcuNumber internal class to serve as the business logic layer for formatting and parsing. Added formatters for long and double to output native digits + tests to confirm that they are the same as the DecimalFormat instance that backs RuleBasedNumberFormat. Also added FormatPlural() method + tests and FormatXXXRuleBased() overloads to prepare the parameters for the call into the rules engine (NumberFormatRules) that is passed.
  7. ICU4N.Text.ValueStringBuilder: Added Insert() overload to handle ReadOnlySpan<char>
  8. Added target for .NET 7.0. Fixed conflicts due to the new AsReadOnly() extension methods and build errors due the unsafe logic in PluralRules.

Improvements

  1. PERFORMANCE: ICU4N.Globalization.UCultureInfo.Name: Cache the name locally so it doesn't have to be parsed on every request.
  2. ICU4N.Globalization.UCultureInfo::Canonicalize(): Added null guard clause
  3. ICU4N.Impl.PluralRulesLoader + ICU4N.Text.PluralRules: Added GetInstance() overload that accepts the culture name as a string, for use by internal UCultureData class.
  4. ICU4N.Globalization.UNumberFormatInfoTest: Added tests to verify all cultures load decimal format settings correctly (we still have some way to go for currency data)
  5. ICU4N.Globalization.NumberPresentationExtensions: Added IsDefined() method so we can quickly check for valid values in guard clauses.
  6. ICU4N.Numerics.DecimalQuantity_AbstractBCD: Optimized number parsing using ReadOnlySpan<char> where appropriate.
  7. Changed the name of FEATURE_READONLYDICTIONARY to FEATURE_IREADONLYCOLLECTIONS to include IReadOnlyList<T>.
  8. ICU4N.Globalization.NumberPresentationExtensions: Added an internal extension method to quickly lookup the NumberingSystemRules instance for the current UNumberFormatInfo.
  9. ICU4N.Globalization.UCultureInfo: Added ReadOnly() and Clone() implementations and added API documentation for NumberFormat, IsReadOnly, ReadOnly() and Clone() members.
  10. ICU4N.Impl.ICUResourceBundle.WholeBundle: Lazy-load the UCultureInfo instance so we don't fill up the UCultureData cache with all cultures and non-culture resource names.

Bug Fixes

  1. ICU4N.Util.ResourceBundle::SetRootType(): Fixed fallthrough to default for Missing case