Pragmatic.Internationalization.AspNetCore
1.0.0-alpha.6
dotnet add package Pragmatic.Internationalization.AspNetCore --version 1.0.0-alpha.6
NuGet\Install-Package Pragmatic.Internationalization.AspNetCore -Version 1.0.0-alpha.6
<PackageReference Include="Pragmatic.Internationalization.AspNetCore" Version="1.0.0-alpha.6" />
<PackageVersion Include="Pragmatic.Internationalization.AspNetCore" Version="1.0.0-alpha.6" />
<PackageReference Include="Pragmatic.Internationalization.AspNetCore" />
paket add Pragmatic.Internationalization.AspNetCore --version 1.0.0-alpha.6
#r "nuget: Pragmatic.Internationalization.AspNetCore, 1.0.0-alpha.6"
#:package Pragmatic.Internationalization.AspNetCore@1.0.0-alpha.6
#addin nuget:?package=Pragmatic.Internationalization.AspNetCore&version=1.0.0-alpha.6&prerelease
#tool nuget:?package=Pragmatic.Internationalization.AspNetCore&version=1.0.0-alpha.6&prerelease
Pragmatic.Internationalization
Comprehensive internationalization (i18n) and localization (l10n) for .NET 10: async-safe culture context, money & currency value types, culture-aware formatting, compile-time-checked translations with plural support, and humanizers.
The Problem
.NET gives you low-level globalization primitives (CultureInfo, .resx), but a real multilingual app
hits the same gaps:
- Thread culture is fragile:
CurrentCultureis thread-local; after anawaityour continuation may run on a different thread, andDefaultThreadCurrentCultureis a process-wide, multi-tenant trap. - No multi-scope culture: a request may need Italian UI, English API responses, German invoices. .NET gives you two slots; beyond that you're on your own.
- Money is not a type: every app reinvents a
Moneystruct, silently adds USD to EUR, and formats inconsistently. - Plurals are language-specific: English has 2 forms, Russian 3, Arabic 6;
count == 1 ? a : bis wrong for most of the world. .resxdoesn't compose: translations scatter across XML with no build-time completeness check; you can ship with half a language missing.
The Solution: five pillars
I18NContext: anAsyncLocalambient context that flows acrossawait, supports multiple culture scopes (UI, Data, custom), and syncs with .NET thread cultures.Money&CurrencyCode: value types enforcing same-currency arithmetic, ISO 4217 metadata, and culture-aware formatting.- Formatting: extension methods + an injectable
GlobalizationFormatterfor numbers, dates, money, percentages, and file sizes. - Translation keys (SG): a generator reads JSON at compile time and produces a static
Tclass of strongly-typedLocalizedStringproperties; missing translations are build warnings (PRAG1802). - Humanizers: duration, ordinal, quantity, and relative-time formatters for 17+ languages.
var price = Money.From(99.99m, CurrencyCode.EUR);
price.Format(); // "99,99 €" (it-IT) / "€99.99" (en-US)
var subject = T.Emails.OrderShipped.Value; // compile-time-safe translation, current culture
The middleware sets I18NContext from Accept-Language / query string / a provider chain, and it
flows across every await automatically.
Quick Start: translations
- Add JSON files under
translations/(one per culture:en.json,it.json, …). - Include them in your
.csproj:<AdditionalFiles Include="translations/*.json" />. - Reference
Pragmatic.SourceGenerator. - Use the generated
Tclass:
var text = T.Welcome.Value; // current culture
var italian = T.Common.Welcome["it"]; // a specific culture
Full walkthrough: Getting Started.
Packages
| Package | Description |
|---|---|
Pragmatic.Internationalization |
Core: context, Money/CurrencyCode, formatting, humanizers, generated T |
Pragmatic.Internationalization.AspNetCore |
Culture middleware, ProblemDetails localization, frontend endpoint |
Pragmatic.Internationalization.EFCore |
LocalizedString (JSON column) and CurrencyCode (varchar(3)) entity storage |
Pragmatic.Internationalization.Engines |
LocalizedString on Pragmatic's Sql engine: the same JSON text EF Core writes. The documents engine needs no package |
Installation
dotnet add package Pragmatic.Internationalization
dotnet add package Pragmatic.SourceGenerator # generates the strongly-typed T class
Features at a glance
- Async-safe, multi-scope culture context (UI / Data / custom).
Moneywith same-currency-enforced arithmetic + ISO 4217CurrencyCode.- Culture-aware formatters for numbers, dates, money, percent, file sizes.
- Compile-time-checked translations with CLDR plural rules.
- Humanizers for duration, ordinals, quantities, relative time (17+ languages).
- ASP.NET Core middleware + EF Core
LocalizedStringstorage.
Status
Functional within 1.0.0-alpha: the five pillars, the translation generator, and the ASP.NET Core and EF Core integrations; the surface may still change before 1.0. See the roadmap and the CHANGELOG.
Documentation
| Guide | What you'll learn |
|---|---|
| Concepts | The five pillars in depth: culture context, Money/Currency, formatting, plural rules, humanizers, integrations |
| Getting Started | Translations, Money, formatting, and humanizers from zero |
| Integration | ASP.NET Core middleware, I18NBuilder/UseI18N, translation endpoint, localized ProblemDetails, EF Core |
| Translation Keys | JSON layout, the generated T class, plural forms, completeness warnings |
| Common Mistakes | The most frequent i18n pitfalls |
| Troubleshooting | Problem/solution guide with diagnostics |
Requirements
- .NET 10.0+
Pragmatic.SourceGeneratoranalyzer (for the translationTclass)
License
Part of the Pragmatic.Design ecosystem. See Licensing. Pragmatic.Internationalization is MIT-licensed.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. net11.0 is compatible. |
-
net10.0
- Pragmatic.Composition (>= 1.0.0-alpha.6)
- Pragmatic.Ensure (>= 1.0.0-alpha.6)
- Pragmatic.Internationalization (>= 1.0.0-alpha.6)
- Pragmatic.Result.AspNetCore (>= 1.0.0-alpha.6)
-
net11.0
- Pragmatic.Composition (>= 1.0.0-alpha.6)
- Pragmatic.Ensure (>= 1.0.0-alpha.6)
- Pragmatic.Internationalization (>= 1.0.0-alpha.6)
- Pragmatic.Result.AspNetCore (>= 1.0.0-alpha.6)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0-alpha.6 | 126 | 11/21/2026 |
| 1.0.0-alpha.5 | 56 | 11/21/2026 |
| 1.0.0-alpha.4 | 113 | 11/16/2026 |
| 1.0.0-alpha.3 | 503 | 10/17/2026 |
| 1.0.0-alpha.2 | 123 | 10/12/2026 |
| 1.0.0-alpha.1 | 340 | 10/3/2026 |