Find a Humanizer scenario
Start with the value you already have and the text you need to produce. Humanizer keeps dates, durations, numbers, byte sizes, enums, and collections as typed values until the display boundary; each guide below shows the operation, deterministic culture or clock setup, and failure behavior.
| You have | You want | Start here |
|---|---|---|
| An identifier or label | Readable text or another identifier convention | Strings and casing |
| A noun and count | Correct singular/plural quantity text | Inflection and quantities |
| A date, time, or duration | Relative, elapsed, fluent, or spoken output | Date and time scenarios |
| A number or number phrase | Words, ordinals, parsing, metric, or Roman output | Number and data scenarios |
| An enum or sequence | A readable label or localized list | Enum and collection scenarios |
| A culture-specific rule | Explicit culture or custom behavior | Localization and extensibility |
Example
This smallest example demonstrates the shared rule: set culture explicitly and call Humanizer at the presentation boundary.
Program.cs
using System.Globalization;
using Humanizer;
CultureInfo.CurrentCulture = CultureInfo.GetCultureInfo("en-US");
CultureInfo.CurrentUICulture = CultureInfo.GetCultureInfo("en-US");
var result = TimeSpan.FromMinutes(2).Humanize();
Console.WriteLine(result);
Output
2 minutes
Less common tasks
- Truncation and dehumanization
- Byte sizes and transfer rates
- Specialized formatting utilities
- Trimming and Native AOT
Keep the typed value
Humanized output is presentation text, not a stable storage or wire format. Keep the original typed value and regenerate text for the active culture. A parser such as TryToNumber or ByteSize.TryParse has an explicit input contract; it does not make arbitrary humanized output round-trip safe.