You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
TP-Blazor/TP Blazor/Controllers/CultureController.cs

19 lines
597 B

using Microsoft.AspNetCore.Localization;
using Microsoft.AspNetCore.Mvc;
namespace TP_Blazor.Controllers;
[Microsoft.AspNetCore.Mvc.Route("[controller]/[action]")]
public class CultureController:Controller
{
public IActionResult SetCulture(string culture, string returnUrl)
{
if(culture != null)
{
this.HttpContext.Response.Cookies.Append(
CookieRequestCultureProvider.DefaultCookieName,
CookieRequestCultureProvider.MakeCookieValue(new RequestCulture(culture)));
}
return this.LocalRedirect(returnUrl);
}
}