Typed localization contracts
Generators & Analyzers
Move localization mistakes from runtime into the build.
Explore source ↗Capability
An incremental generator creates strongly typed keys and provider manifests while Roslyn analyzers catch missing keys, placeholder mismatches, and catalog gaps.
- 01
Strongly typed keys
- 02
Incremental generation
- 03
Placeholder diagnostics
- 04
IStringLocalizer and DI integration
How it composes
From intent
to working system.
Scan
The build discovers catalogs and declared translation keys.
Generate
Typed APIs and provider metadata join the compilation.
Analyze
Roslyn diagnostics compare usage, placeholders, and coverage.
Integrate
DI and IStringLocalizer adapters expose generated services to applications.
Quick start
Adopt this
capability.
Start with the primary module, then add the related packages only when the application needs those layers. Replace VERSION with the current NuGet version.
dotnet add package ProTranslate.SourceGeneratordotnet add package ProTranslate.Analyzers<PackageReference Include="ProTranslate.SourceGenerator" Version="VERSION" /><PackageVersion Include="ProTranslate.SourceGenerator" Version="VERSION" />var title = Translations.Shell.Title;var greeting = Translations.Account.Greeting(user.DisplayName);Modules in this capability
Use one layer.
Compose the rest.
Source of truth
Read the module beside the complete system.
The implementation, samples, issues, and release notes stay in the parent repository so module details remain connected to the product architecture.