# Humanizer — String, Date & Number Manipulation for .NET > Humanizer transforms .NET strings, enums, dates, times, timespans, numbers, and quantities into human-friendly representations, with full localization support for dozens of languages. ## Install Save as a script file and run: # Humanizer — String, Date & Number Manipulation for .NET ## Quick Use ```bash dotnet add package Humanizer ``` ```csharp using Humanizer; "PascalCaseString".Humanize(); // "Pascal case string" DateTime.UtcNow.AddHours(-3).Humanize(); // "3 hours ago" 1.ToWords(); // "one" ``` ## Introduction Humanizer is a .NET library that turns machine-oriented data into human-readable text. Whether you need to display relative timestamps, pluralize nouns, truncate strings, or convert enums to friendly labels, Humanizer provides a consistent fluent API that keeps your UI code clean and your output natural. ## What Humanizer Does - Converts PascalCase, camelCase, underscore_case, and kebab-case strings to sentence or title case - Displays relative dates and times (e.g., "2 days ago", "in 3 months") - Pluralizes and singularizes English nouns with override support - Converts numbers to ordinal strings, words, and Roman numerals - Truncates strings with configurable strategies (fixed length, word boundary, character) ## Architecture Overview Humanizer is a pure .NET library distributed as a single NuGet package. It targets .NET Standard 2.0 and above, which means it runs on .NET Framework 4.7+, .NET Core, .NET 5-9, Xamarin, and Unity. Localization resources for 40+ languages are bundled as satellite assemblies, and the fluent extension-method API means zero configuration for most use cases. ## Self-Hosting & Configuration - Install via NuGet: `dotnet add package Humanizer` - No external dependencies or services required - Localization is automatic based on `Thread.CurrentThread.CurrentUICulture` - Override pluralization rules by registering custom vocabularies - Extend with your own `IStringTransformer` or `ITruncator` implementations ## Key Features - Fluent extension methods on `string`, `DateTime`, `TimeSpan`, `int`, and `enum` - 40+ localized language packs for date and number humanization - Multiple truncation strategies: fixed length, word, character - ByteSize helper for human-readable file sizes (e.g., "1.2 GB") - Metric prefix support for scientific and engineering notation ## Comparison with Similar Tools - **String.Format / interpolation** — built-in but no relative dates, pluralization, or casing transforms - **NodaTime** — advanced date/time modeling but no humanization layer - **Pluralize.NET** — pluralization only; Humanizer covers strings, dates, numbers too - **FluentDateTime** — date arithmetic helpers; does not humanize output - **SmartFormat.NET** — template-based formatting; Humanizer is more extension-method driven ## FAQ **Q: Does Humanizer support my language?** A: Humanizer ships with localized resources for 40+ languages including Spanish, French, German, Chinese, Japanese, Arabic, and many more. **Q: Can I use Humanizer in Blazor or MAUI apps?** A: Yes. Humanizer targets .NET Standard 2.0, so it works in Blazor, MAUI, WPF, WinForms, and any .NET runtime. **Q: How do I add custom pluralization rules?** A: Call `Vocabularies.Default.AddIrregular("person", "people")` or `AddUncountable("fish")` at startup. **Q: Is Humanizer thread-safe?** A: Yes. All extension methods are pure functions. Culture is read from the current thread at call time. ## Sources - https://github.com/Humanizr/Humanizer - https://humanizr.net --- Source: https://tokrepo.com/en/workflows/asset-26cd05cf Author: Script Depot