Skip to content

8.0.0

Latest

Choose a tag to compare

@jeffijoe jeffijoe released this 23 Feb 21:57
dae6f0b

Breaking Changes

CultureInfo-based API replaces string locale (#54) — @jeffijoe

The entire API surface now uses System.Globalization.CultureInfo instead of a string locale. This affects:

  • MessageFormatter constructor: The locale parameter (string, defaulting to "en") has been replaced with culture (CultureInfo?, defaulting to null which resolves to CultureInfo.CurrentCulture).
  • MessageFormatter.Locale property has been removed. Replaced by a read-only MessageFormatter.Culture property (CultureInfo?).
  • IMessageFormatter.FormatMessage now accepts an optional CultureInfo? culture parameter, allowing per-call culture overrides. When null, falls back to the instance's Culture, then to CultureInfo.CurrentCulture.
  • MessageFormatter.Format (static) also accepts the optional CultureInfo? culture parameter.
  • IFormatter.Format: The string locale parameter is now CultureInfo culture.
  • Extension methods on IMessageFormatter (FormatMessage overloads) all accept the optional culture parameter.

Migration: Replace new MessageFormatter(locale: "en") with new MessageFormatter(culture: CultureInfo.GetCultureInfo("en")), and update any custom IFormatter implementations to accept CultureInfo instead of string.

Pluralizer dictionaries renamed (#52) — @sfuqua

  • MessageFormatter.Pluralizers has been replaced by two separate properties: CardinalPluralizers and OrdinalPluralizers.
  • PluralFormatter.Pluralizers (IDictionary<string, Pluralizer>) has been renamed to CardinalPluralizers. A new OrdinalPluralizers dictionary has been added for ordinal rules.
  • The PluralRuleKey type has been removed.

Migration: Replace formatter.Pluralizers[locale] with formatter.CardinalPluralizers[locale] for cardinal rules, or formatter.OrdinalPluralizers[locale] for ordinal rules.

.NET 6 target removed (#54) — @jeffijoe

  • Removed net6.0 target framework (.NET 6 is end-of-life).
  • Added net10.0 target framework.
  • Supported targets are now: netstandard2.0, netstandard2.1, net8.0, net10.0.

New Features

selectordinal support with CLDR ordinal rules (#52) — @sfuqua

Full support for the ICU selectordinal function, powered by auto-generated CLDR ordinal plural rules. Previously, ordinal pluralization was only available for English via hard-coded rules. Now, ordinal rules for all CLDR locales are source-generated alongside the existing cardinal rules.

CLDR updated to v48.1 (#52) — @sfuqua

Both cardinal and ordinal plural rules are now sourced from CLDR v48.1.

Locale fallback (#52) — @sfuqua

Plural rule lookup now implements partial LDML locale inheritance. For example, en-GB will fall back to en, then to the CLDR root locale. This means locales with region/script subtags work out of the box without needing to register custom pluralizers.

Built-in pluralizers removed in favor of CLDR rules (#52) — @sfuqua

The hard-coded English cardinal and ordinal pluralizers have been removed. All plural rules are now sourced from the CLDR via the source generator, ensuring correctness and consistency across all supported locales.

Per-call culture override (#54) — @jeffijoe

FormatMessage now accepts an optional CultureInfo? culture parameter, allowing you to override the culture on a per-call basis without changing the formatter instance's default culture.

Performance

Replace Microsoft.Extensions.ObjectPool with built-in Roslyn-based pool (#55) — @jeffijoe

The Microsoft.Extensions.ObjectPool dependency has been removed and replaced with a built-in lock-free object pool ported from Roslyn. This eliminates an external dependency and is approximately 50% faster overall, though it may allocate more under heavy contention.

Internal

  • Migrated source generator from ISourceGenerator to incremental generator (IIncrementalGenerator) (#54) — @jeffijoe
  • Upgraded NuGet packages (#54) — @jeffijoe
  • CI updated to use .NET 10 (#54) — @jeffijoe

New Contributors

Full Changelog: 7.1.3...8.0.0