27 lines
762 B
C#
27 lines
762 B
C#
|
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)
|
||
|
{
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|