Skip to main content
Version: 4.0 (next)

Grammar and platform formatting

Humanizer APIs expose grammatical gender, word form, and grammatical case where the result needs information that a number or date cannot carry by itself. These arguments affect language rules; they are not presentation-only labels.

Calendar names and numeric punctuation are a separate layer. .NET Framework uses Windows NLS, while modern .NET normally uses ICU. When those sources disagree, Humanizer uses an explicit locale-profile override where one is defined. Otherwise the runtime globalization data is authoritative. Test the target frameworks and platforms the application ships.

Example

using System.Globalization;
using Humanizer;

var spanish = CultureInfo.GetCultureInfo("es");

Console.WriteLine(1.ToWords(GrammaticalGender.Feminine, spanish));
Console.WriteLine(1.ToWords(
WordForm.Abbreviation,
GrammaticalGender.Masculine,
spanish));

var czech = CultureInfo.GetCultureInfo("cs");
Console.WriteLine(TimeSpan.FromDays(1)
.HumanizeWithCase(GrammaticalCase.Nominative, culture: czech));

The output is:

una
un
jeden den

Pass grammar explicitly when the surrounding noun or sentence determines it. The default gender or case is a locale convention, not a guess about your domain text.

TimeSpan.HumanizeWithCase applies case only to a bare duration phrase. It does not add a preposition and does not alter the separate relative-date or date-ordinal grammar paths.

Keep language rules and presentation separate

Not every grammatical option has a distinct natural form in every locale. Do not manufacture a gender or case by post-processing Humanizer output. Choose a supported overload and test the complete phrase native speakers will see.

Caller-supplied custom format providers remain authoritative. Without a custom provider or a Humanizer locale-profile override, calendar names and numeric punctuation follow the runtime globalization data for the target framework and platform.

For incorrect grammar or platform-specific output, use the language correction guide or open a prefilled locale issue.

DateOnly and TimeOnly APIs require a target framework on which those types exist.