Skip to content

AddMessageLocalization ​

Registers message resolution: the language provider that negotiates a language from the request, the message provider that reads the messages/ directory, and the resolver that turns a message key into localized text.

Anything that produces localized text depends on it, including the error responses, validation messages, and maintenance notices of the other ASP.NET packages. None of them register it, so an application that uses any of those calls this once itself.

Usage ​

csharp
using AlmightyShogun.AspNet.Localization;

builder.Services.AddMessageLocalization(builder.Configuration);

WebApplication app = builder.Build();

app.UseMessageLocalization();

Parameters

configuration: IConfiguration
Application configuration, read for the optional Localization section.

Returns

The same IServiceCollection instance with message localization registered.

Type signature ​

csharp
public IServiceCollection AddMessageLocalization(
    IConfiguration configuration
);

All packages are released under the MIT License.