Initialize culture settings in App.razor
Added dependency injection for `CultureService` in `App.razor` to dynamically initialize culture settings during the component's lifecycle. Included `System.Globalization` and `EnvelopeGenerator.ReceiverUI.Services` namespaces to support culture-related functionality. Injected `CultureService` and added an `OnInitializedAsync` method to set `CultureInfo.DefaultThreadCurrentCulture` and `CultureInfo.DefaultThreadCurrentUICulture` based on the service's initialization. Reformatted surrounding `<Router>` code for clarity.
This commit is contained in:
@@ -1,4 +1,8 @@
|
|||||||
<Router AppAssembly="@typeof(Program).Assembly">
|
@using System.Globalization
|
||||||
|
@using EnvelopeGenerator.ReceiverUI.Services
|
||||||
|
@inject CultureService CultureService
|
||||||
|
|
||||||
|
<Router AppAssembly="@typeof(Program).Assembly">
|
||||||
<Found Context="routeData">
|
<Found Context="routeData">
|
||||||
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
|
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
|
||||||
</Found>
|
</Found>
|
||||||
@@ -8,3 +12,12 @@
|
|||||||
</LayoutView>
|
</LayoutView>
|
||||||
</NotFound>
|
</NotFound>
|
||||||
</Router>
|
</Router>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
var culture = await CultureService.InitializeCultureAsync();
|
||||||
|
CultureInfo.DefaultThreadCurrentCulture = culture;
|
||||||
|
CultureInfo.DefaultThreadCurrentUICulture = culture;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user