mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-23 13:41:31 +00:00
Fix languages not changing
This commit is contained in:
parent
7b1c8d4591
commit
40b3ebdc6c
1 changed files with 13 additions and 0 deletions
|
@ -1,5 +1,8 @@
|
|||
using System.Globalization;
|
||||
using LBPUnion.ProjectLighthouse.Localization;
|
||||
using LBPUnion.ProjectLighthouse.Middlewares;
|
||||
using Microsoft.AspNetCore.HttpOverrides;
|
||||
using Microsoft.AspNetCore.Localization;
|
||||
|
||||
#if !DEBUG
|
||||
using Microsoft.Extensions.Hosting.Internal;
|
||||
|
@ -38,6 +41,16 @@ public class WebsiteStartup
|
|||
}
|
||||
);
|
||||
|
||||
services.Configure<RequestLocalizationOptions>(config =>
|
||||
{
|
||||
List<CultureInfo> languages = LocalizationManager.GetAvailableLanguages().Select(l => new CultureInfo(LocalizationManager.MapLanguage(l))).ToList();
|
||||
|
||||
config.DefaultRequestCulture = new RequestCulture(new CultureInfo("en-US"));
|
||||
|
||||
config.SupportedCultures = languages;
|
||||
config.SupportedUICultures = languages;
|
||||
});
|
||||
|
||||
#if DEBUG
|
||||
services.AddSingleton<IHostLifetime, DebugWarmupLifetime>();
|
||||
#else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue