KamiSama.Modules.Localization.Core
10.0.11.9
dotnet add package KamiSama.Modules.Localization.Core --version 10.0.11.9
NuGet\Install-Package KamiSama.Modules.Localization.Core -Version 10.0.11.9
<PackageReference Include="KamiSama.Modules.Localization.Core" Version="10.0.11.9" />
<PackageVersion Include="KamiSama.Modules.Localization.Core" Version="10.0.11.9" />
<PackageReference Include="KamiSama.Modules.Localization.Core" />
paket add KamiSama.Modules.Localization.Core --version 10.0.11.9
#r "nuget: KamiSama.Modules.Localization.Core, 10.0.11.9"
#:package KamiSama.Modules.Localization.Core@10.0.11.9
#addin nuget:?package=KamiSama.Modules.Localization.Core&version=10.0.11.9
#tool nuget:?package=KamiSama.Modules.Localization.Core&version=10.0.11.9
KamiSama.Modules.Localization.Core
Version: 10.0.0
Description
ASP.NET Core localization registration and scoped features for configured culture discovery, current-culture lookup, and culture-selection cookies. Use it to bind localization settings and compose request localization through KamiSama.Modules.
How to use
dotnet add package KamiSama.Modules.Localization.Core --version 10.0.0
Version 10.0.0 in the install command is the current workspace/root documentation version. This package version was not published at the time of review; when installing from NuGet, replace it with a version that is actually available.
Register IHttpContextAccessor before adding the localization module, bind the module section, and build through the extended builder:
using KamiSama.Modules;
using KamiSama.Modules.Localization;
var webBuilder = WebApplication.CreateBuilder(args);
webBuilder.Services.AddHttpContextAccessor();
var builder = webBuilder.Extend()
.AddLocalizationModule(webBuilder.Configuration.GetSection("Localization"));
var app = await builder.BuildAsync(CancellationToken.None);
The effective request provider precedence is Accept-Language header, then query string, then cookie because each provider is inserted at the front. SetCulture.SetAsync validates configured metadata and appends a one-year response cookie; it does not change the current request, so the cookie participates on a later request and still loses to header or query values. The three feature methods complete synchronously and ignore cancellation. ListAvailableCultures.ListAsync exposes the mutable configured array directly, and options also accept mutable replacement arrays. GetCurrentCulture falls back only when the current UI culture is neutral and synthesizes metadata when no configured entry matches.
Namespaces
- KamiSama.Modules.Localization (3 types)
- KamiSama.Modules.Localization.Features (3 types)
Types
- KamiSama.Modules.Localization.ExtendedWebApplicationBuilderExtensions - Adds request localization and the localization core module in the required order. Provider insertion produces Accept-Language, query-string, then cookie precedence.
- KamiSama.Modules.Localization.LocalizationModule - Registers localization options, resources, and attributed scoped feature implementations. A preceding request-localization module owns middleware configuration.
- KamiSama.Modules.Localization.LocalizationOptions - Holds mutable supported-culture metadata and the default culture name bound from configuration. Culture arrays are exposed directly rather than copied.
- KamiSama.Modules.Localization.Features.GetCurrentCulture - Maps the current UI culture to configured metadata, using the configured default only for neutral cultures. It synthesizes metadata for an unmatched culture and ignores cancellation.
- KamiSama.Modules.Localization.Features.ListAvailableCultures - Returns the configured mutable culture array directly and substitutes an empty array only for a null option value. It ignores cancellation.
- KamiSama.Modules.Localization.Features.SetCulture - Validates configured culture metadata and appends a one-year request-culture cookie to the active response. It requires
AddHttpContextAccessor, affects a later request, and ignores cancellation.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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
- KamiSama.Chassis.Commons (>= 10.0.11.9)
- KamiSama.Extensions.DependencyInjection (>= 10.0.11.9)
- KamiSama.Modules (>= 10.0.11.9)
- KamiSama.Modules.Localization.Abstractions (>= 10.0.11.9)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.