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

27 lines
968 B
C#

using BlueWest.Localization.Models;
using Microsoft.AspNetCore.Localization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore.Metadata.Internal;
using Microsoft.Extensions.Options;
namespace CodeLiturgy.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);
// }
}