ArchPillar.Extensions.Localization.WebAssembly
1.5.0-preview9
dotnet add package ArchPillar.Extensions.Localization.WebAssembly --version 1.5.0-preview9
NuGet\Install-Package ArchPillar.Extensions.Localization.WebAssembly -Version 1.5.0-preview9
<PackageReference Include="ArchPillar.Extensions.Localization.WebAssembly" Version="1.5.0-preview9" />
<PackageVersion Include="ArchPillar.Extensions.Localization.WebAssembly" Version="1.5.0-preview9" />
<PackageReference Include="ArchPillar.Extensions.Localization.WebAssembly" />
paket add ArchPillar.Extensions.Localization.WebAssembly --version 1.5.0-preview9
#r "nuget: ArchPillar.Extensions.Localization.WebAssembly, 1.5.0-preview9"
#:package ArchPillar.Extensions.Localization.WebAssembly@1.5.0-preview9
#addin nuget:?package=ArchPillar.Extensions.Localization.WebAssembly&version=1.5.0-preview9&prerelease
#tool nuget:?package=ArchPillar.Extensions.Localization.WebAssembly&version=1.5.0-preview9&prerelease
ArchPillar.Extensions.Localization.WebAssembly
Blazor WebAssembly startup helper for ArchPillar.Extensions.Localization.
A browser has no readable file system, so the directory catalog source finds nothing; a WebAssembly client fetches its catalogs over HTTP from the app's static web assets instead. This package wires that up in one call.
var options = new LocalizerOptions { SourceCulture = "en" };
builder.Services.AddArchPillarLocalization(options);
WebAssemblyHost host = builder.Build();
// Pass the SAME options instance used above — this reconfigures the ambient store from scratch,
// so anything the DI registration set (source culture, formats, hot reload, …) would otherwise be lost.
await host.UseArchPillarLocalizationAsync(options);
await host.RunAsync();
UseArchPillarLocalizationAsync creates a ManifestCatalogProvider over the manifest (apl-catalogs.json,
emitted by the build), registers it on the ambient store by reconfiguring with the provider appended to
Providers (Localizer.Ambient.Configure(options with { Providers = [.. options.Providers, _ => provider] })), and
loads the active culture with Localizer.LoadCultureAsync, so the first render is localized. Because the
manifest is registered — not loaded once and forgotten — another language is fetched on demand the
moment it is needed:
// When the app selects a different language, load its catalogs (instant from the PWA cache):
await Localizer.LoadCultureAsync(culture);
It uses the app's DI-registered HttpClient — the one the Blazor WebAssembly template registers over the host
base address — so the container owns the client and the provider reuses it for languages selected later. Loading
catalogs is all this does — the active culture is the app's concern.
Re-rendering when a language is selected
Selecting a language is a normal Blazor event — do the load inside the handler, then set the culture:
private async Task SetCulture(CultureInfo culture)
{
await Localizer.LoadCultureAsync(culture); // catalogs are in place before the next render
CultureInfo.CurrentUICulture = culture;
}
Blazor re-renders the handler's component tree when it returns, with the translations already loaded — no base class, no special component.
For the rarer case where a catalog lands from a background fetch (a synchronous lookup of a culture nobody preloaded), the ambient store raises Localizer.CatalogsChanged. Blazor has no global "re-render the app" hook, so the refresh policy is the app's to choose — typically a cascading value at the app root, or a root component that refreshes. Subscribe there and marshal onto the renderer, since the event fires off the background-load thread:
// in a root-level component (App/Layout), not per leaf component
protected override void OnInitialized() => Localizer.CatalogsChanged += OnCatalogsChanged;
public void Dispose() => Localizer.CatalogsChanged -= OnCatalogsChanged;
private void OnCatalogsChanged() => InvokeAsync(StateHasChanged);
| 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 is compatible. 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
- ArchPillar.Extensions.Localization (>= 1.5.0-preview9)
- Microsoft.AspNetCore.Components.WebAssembly (>= 10.0.5)
- Microsoft.Extensions.DependencyInjection (>= 10.0.5)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.5)
- Microsoft.Extensions.Logging (>= 10.0.5)
-
net8.0
- ArchPillar.Extensions.Localization (>= 1.5.0-preview9)
- Microsoft.AspNetCore.Components.WebAssembly (>= 8.0.25)
- Microsoft.Extensions.DependencyInjection (>= 8.0.1)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Logging (>= 8.0.1)
-
net9.0
- ArchPillar.Extensions.Localization (>= 1.5.0-preview9)
- Microsoft.AspNetCore.Components.WebAssembly (>= 9.0.14)
- Microsoft.Extensions.DependencyInjection (>= 9.0.14)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.14)
- Microsoft.Extensions.Logging (>= 9.0.14)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.5.0-preview9 | 69 | 8/3/2026 |
| 1.5.0-preview8 | 72 | 7/31/2026 |
| 1.5.0-preview7 | 59 | 7/30/2026 |
| 1.5.0-preview15 | 68 | 8/21/2026 |
| 1.5.0-preview14 | 79 | 8/17/2026 |
| 1.5.0-preview13 | 70 | 8/11/2026 |
| 1.5.0-preview12 | 69 | 8/10/2026 |
| 1.5.0-preview11 | 69 | 8/10/2026 |
| 1.5.0-preview10 | 71 | 8/6/2026 |