-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathProgram.cs
More file actions
36 lines (28 loc) · 1.24 KB
/
Copy pathProgram.cs
File metadata and controls
36 lines (28 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// BlazorWasm
using BlazorShared.Layout;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using System.Globalization;
using Yaml.Localization;
foreach (var resource in typeof(BlazorShared.Lang).Assembly.GetManifestResourceNames())
{
Console.WriteLine(resource);
}
var culture = CultureInfo.CurrentCulture;
while (culture.IsNeutralCulture)
{
culture = CultureInfo.CreateSpecificCulture(culture.Name);
}
CultureInfo.CurrentCulture = culture;
CultureInfo.CurrentUICulture = culture;
Console.WriteLine($" - Standalone WASM - Current culture: {CultureInfo.CurrentUICulture.Name} - {CultureInfo.CurrentUICulture.IsNeutralCulture}");
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.Services
.AddScoped<IPlatformService, WebAssemblyPlatformService>()
.AddScoped<ChangeThemeStore>()
.AddScoped<CultureSelectorStore>()
.AddYamlEmbeddedResourceLocalization(typeof(BlazorShared.Lang).Assembly);
builder.RootComponents.Add<BlazorWasm.Components.App>("#app");
builder.RootComponents.Add<HeadOutlet>("head::after");
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
await builder.Build().RunAsync();