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;
|
|
|
|
|
2022-10-30 19:48:24 +03:00
|
|
|
namespace CodeLiturgy.Views.Localization.ViewComponents;
|
2022-09-26 04:05:23 +03:00
|
|
|
|
|
|
|
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);
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
}
|