Bsft.Localization 2.2.0

dotnet add package Bsft.Localization --version 2.2.0
                    
NuGet\Install-Package Bsft.Localization -Version 2.2.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="Bsft.Localization" Version="2.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Bsft.Localization" Version="2.2.0" />
                    
Directory.Packages.props
<PackageReference Include="Bsft.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 Bsft.Localization --version 2.2.0
                    
#r "nuget: Bsft.Localization, 2.2.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 Bsft.Localization@2.2.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=Bsft.Localization&version=2.2.0
                    
Install as a Cake Addin
#tool nuget:?package=Bsft.Localization&version=2.2.0
                    
Install as a Cake Tool

Bsft.Localization

Store-backed translations with a tenant-aware fallback chain, exposed through the standard IStringLocalizer, plus the read endpoints a front end fetches its bundle from. This is the resolution half of the family; Bsft.Localization.EFCore is the store half.

Install

dotnet add package Bsft.Localization

Requires Bsft.Data (the tenant context the chain reads), Bsft.EventAggregator (the invalidation event) and Bsft.Http (the entity tags the bundle endpoint serves). It stores nothing itself: reference Bsft.Localization.EFCore as well, or implement ITranslationReader.

Register

// Compiled-in defaults, contributed by each module.
services.AddBsftTranslations(seed => seed
    .ForLocale("en", en => en.Add("orders.status.pending", "Pending"))
    .ForLocale("de", de => de.Add("orders.status.pending", "Ausstehend")));

// The runtime: locales, cache, invalidation, endpoints.
services.AddBsftLocalization(options => options.FallbackLocale = "en");

// or bound from configuration, section "Bsft:Localization"
services.AddBsftLocalization(configuration);

// The store half.
services.AddBsftLocalizationEFCore<AppDbContext>();

Both registrations are needed. AddBsftLocalization does not register a translation seed, and resolving IStringLocalizerFactory needs the TranslationSeed singleton that only AddBsftTranslations adds — an application that calls only AddBsftLocalization fails when the factory is first resolved. Map the endpoints with app.MapBsftLocalization().

GET {prefix}/{locale} serves a language tag the runtime knows and answers anything else with 400: the segment picks a cache entry that lives for half an hour, so what a caller may put there bounds what an anonymous request can make the process hold.

Configure

BsftLocalizationOptions.SectionName is "Bsft:Localization".

Option Default Effect
BsftLocalizationOptions.DefaultLocale "en" The locale assumed when a request names none.
BsftLocalizationOptions.FallbackLocale "en" The locale consulted when the requested one has no match for a key.
BsftLocalizationOptions.RoutePrefix "/api/localization" Where MapBsftLocalization mounts the three read endpoints. Read once, at map time.
BsftLocalizationOptions.MaxFilterModules 32 Distinct modules one ?modules= filter may name.
BsftLocalizationOptions.MaxFilterModuleNameLength 64 Length of one module name in that filter.

Validation: both locales must be non-blank, the route prefix must be an absolute path starting with /, and both filter ceilings must be positive. A failure names the member and the offending value, and it is thrown from AddBsftLocalization as well as on start.

Extend

ITranslationReader (where stored translations come from) is the one seam. Its four reads are the four questions the resolution chain asks — every key of a locale, every candidate row for one key, every row of a locale and its fallback, and the distinct locale codes — and each returns a whole answer the chain then resolves in memory, so a second implementation cannot turn a bundle into a query per key. Bsft.Localization.EFCore registers the shipped implementation with TryAdd, so a host that registered its own keeps it.

Documentation

Topic page: docs/localization.md. Conventions: docs/package-conventions.md.

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 Bsft.Localization:

Package Downloads
Bsft.Localization.EFCore

BSFT Framework EF Core persistence for Bsft.Localization: the translation table, its mapping, the reader behind the resolution chain and the seed applier

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.2.0 89 10/23/2026
2.1.0 138 9/28/2026