27 lines
965 B
C#
27 lines
965 B
C#
|
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);
|
||
|
// }
|
||
|
|
||
|
|
||
|
}
|