I have implemented localization of a Blazor Server-side app (NET6) as described
Update create two new resource:
Create a new class:
public class SharedResource
{
}
Usage:
@page "/culture-example-2"
@using System.Globalization
@inject IStringLocalizer<SharedResource> Loc
<h1>Culture Example 2</h1>
<p>
<b>CurrentCulture</b>: @CultureInfo.CurrentCulture
</p>
<h2>Greeting</h2>
<p>
@Loc["Greeting"]
</p>
<p>
@greeting
</p>
@code {
private string? greeting;
protected override void OnInitialized()
{
greeting = Loc["Greeting"];
}
}