diff options
| author | ivarlovlie <git@ivarlovlie.no> | 2022-12-05 08:01:56 +0100 |
|---|---|---|
| committer | ivarlovlie <git@ivarlovlie.no> | 2022-12-05 08:01:56 +0100 |
| commit | 7c80885a0ae080ff310ced5111eac264e7edd41f (patch) | |
| tree | 7f83ef083220679add00a7f217b389218cf4afc8 /code/api/src/Program.cs | |
| parent | 834721f61aaee7c2e269cb1df70a973289a73852 (diff) | |
| download | greatoffice-7c80885a0ae080ff310ced5111eac264e7edd41f.tar.xz greatoffice-7c80885a0ae080ff310ced5111eac264e7edd41f.zip | |
feat: Get locale from go_locale first
Diffstat (limited to 'code/api/src/Program.cs')
| -rw-r--r-- | code/api/src/Program.cs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/code/api/src/Program.cs b/code/api/src/Program.cs index 749c60a..4b04bf4 100644 --- a/code/api/src/Program.cs +++ b/code/api/src/Program.cs @@ -92,6 +92,12 @@ public static class Program .AddSupportedUICultures(supportedCultures); options.ApplyCurrentCultureToResponseHeaders = true; }); + builder.Services.Configure<RequestLocalizationOptions>(options => { + options.AddInitialRequestCultureProvider(new CustomRequestCultureProvider(async context => + // Get culture from specific cookie + await Task.FromResult(new ProviderCultureResult(context.Request.Cookies[AppCookies.Locale] ?? "en"))) + ); + }); builder.Services .AddDataProtection() |
