CodeLiturgy.Dashboard/BlueWest.Views/Languages/CultureSwitchViewComponent.cs

27 lines
965 B
C#
Raw Normal View History

2022-09-26 04:05:23 +03:00
using BlueWest.Localization.Models;
using Microsoft.AspNetCore.Localization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore.Metadata.Internal;
using Microsoft.Extensions.Options;
namespace BlueWest.Views.Localization.ViewComponents;
public class CultureSwitchViewComponent : ViewComponent
{
private readonly IOptions<RequestLocalizationOptions> localizationOptions;
public CultureSwitchViewComponent(IOptions<RequestLocalizationOptions> localizationOptions) =>
this.localizationOptions = localizationOptions;
// public IViewComponentResult Invoke()
// {
// var cultureFeature = HttpContext.Features.Get<IRequestCultureFeature>();
// var model = new CultureSwitch()
// {
// SupportedCultures = localizationOptions.Value.SupportedUICultures.ToList(),
// CurrentUICulture = cultureFeature.RequestCulture.UICulture
// };
// return View(model);
// }
}