Bogoware.Localization
0.1.0
See the version list below for details.
dotnet add package Bogoware.Localization --version 0.1.0
NuGet\Install-Package Bogoware.Localization -Version 0.1.0
<PackageReference Include="Bogoware.Localization" Version="0.1.0" />
<PackageVersion Include="Bogoware.Localization" Version="0.1.0" />
<PackageReference Include="Bogoware.Localization" />
paket add Bogoware.Localization --version 0.1.0
#r "nuget: Bogoware.Localization, 0.1.0"
#:package Bogoware.Localization@0.1.0
#addin nuget:?package=Bogoware.Localization&version=0.1.0
#tool nuget:?package=Bogoware.Localization&version=0.1.0
Bogoware.Localization
Lightweight, FQDN-keyed localization library for .NET with DI support, culture fallback chains, and pluggable providers.
Supported Platforms: .NET 8 | .NET 10
Documentation | CHANGELOG | NuGet Package
Features
- FQDN-keyed templates — map any type's
FullNameto a localized format string with property placeholders - Culture fallback chain — exact culture → parent culture → invariant culture
- Resolution chain — self-provider → DI provider → registry template → fallback message →
TypeName(Prop=val)format - JSON registry — load templates from embedded resources, files, or raw JSON strings
- In-memory registry — simple dictionary-backed registry for testing
- DI integration —
IServiceCollection.AddLocalization()extension methods - Zero dependencies — only depends on
Microsoft.Extensions.DependencyInjection.AbstractionsandMicrosoft.Extensions.Logging.Abstractions
Installation
dotnet add package Bogoware.Localization
Quick Start
1. Define localizable types
using Bogoware.Localization;
// Marker interface — opt-in for localization
public class RequiredFieldError(string fieldName) : ILocalizable
{
public string FieldName { get; } = fieldName;
}
2. Create JSON templates
localized-messages.en-US.json (embedded resource):
{
"MyApp.Errors.RequiredFieldError": "'{FieldName}' is required"
}
localized-messages.it-IT.json (embedded resource):
{
"MyApp.Errors.RequiredFieldError": "'{FieldName}' è obbligatorio"
}
3. Register in DI
services.AddLocalization(typeof(RequiredFieldError).Assembly);
4. Format
var formatter = serviceProvider.GetRequiredService<ILocalizationFormatter>();
var error = new RequiredFieldError("Email");
// Uses CultureInfo.CurrentUICulture by default
var message = formatter.Format(error);
// → "'Email' is required" (en-US)
// → "'Email' è obbligatorio" (it-IT)
Provider Resolution Chain
The formatter resolves localized strings in this order:
- Self-provider — if the type implements
ILocalizationProvider, callsLocalize(culture) - DI provider — if an
ILocalizationProvider<T>is registered in the container - Registry template — looks up
Type.FullNamein theILocalizationRegistry - Fallback message — uses the default fallback format
- Default fallback —
TypeName(Prop1=val1, Prop2=val2)
License
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. 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. |
-
net10.0
-
net8.0
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Bogoware.Localization:
| Package | Downloads |
|---|---|
|
Bogoware.Localization.AspNetCore
ASP.NET Core integration for Bogoware.Localization — automatic per-request culture resolution and localized JSON serialization. |
GitHub repositories
This package is not used by any popular GitHub repositories.