Bogoware.Localization 0.1.0

There is a newer version of this package available.
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
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Bogoware.Localization" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Bogoware.Localization" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Bogoware.Localization" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Bogoware.Localization --version 0.1.0
                    
#r "nuget: Bogoware.Localization, 0.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Bogoware.Localization@0.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Bogoware.Localization&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Bogoware.Localization&version=0.1.0
                    
Install as a Cake Tool

Bogoware.Localization

Nuget Nuget Documentation

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 FullName to 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.Abstractions and Microsoft.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:

  1. Self-provider — if the type implements ILocalizationProvider, calls Localize(culture)
  2. DI provider — if an ILocalizationProvider<T> is registered in the container
  3. Registry template — looks up Type.FullName in the ILocalizationRegistry
  4. Fallback message — uses the default fallback format
  5. Default fallback — TypeName(Prop1=val1, Prop2=val2)

License

MIT

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.

Version Downloads Last Updated
0.5.3 595 3/20/2026
0.5.2 147 3/20/2026
0.5.1 3,270 3/9/2026
0.5.0 150 3/9/2026
0.4.0 157 2/20/2026
0.3.0 408 2/20/2026
0.2.0 159 2/20/2026
0.1.1 142 2/19/2026
0.1.0 144 2/19/2026