CodeLiturgy.Dashboard/BlueWest.Views/Utils/ControllerExtensions.cs

27 lines
762 B
C#
Raw Normal View History

2022-09-26 04:05:23 +03:00
using Microsoft.AspNetCore.Localization;
using Microsoft.AspNetCore.Mvc;
namespace BlueWest.Views.Utils;
public static class ControllerExtensions
{
public static void HandleGlobalization(this Controller controller)
{
var context = controller.HttpContext;
var requestCultureFeature = context.Features.Get<IRequestCultureFeature>();
var currentCultureName = Routes.DefaultCultureName;
if (requestCultureFeature != null)
{
currentCultureName = requestCultureFeature.RequestCulture.Culture.Name;
}
controller.ViewData[LanguageViewStorage] = currentCultureName;
}
public static void HandlePageName(this Controller controller, string location)
{
}
}