PavelAndreyev1337_itransition-course-project/CollectionApp/CollectionApp.WEB/Views/Shared/_SelectLanguagePartial.cshtml
@using Microsoft.AspNetCore.Builder
@using Microsoft.AspNetCore.Localization
@using Microsoft.AspNetCore.Mvc.Localization
@using Microsoft.Extensions.Options

@inject IViewLocalizer Localizer
@inject IOptions<RequestLocalizationOptions> LocOptions

@{
    var requestCulture = Context.Features.Get<IRequestCultureFeature>();
    var cultureItems = LocOptions.Value.SupportedUICultures
        .Select(c => new SelectListItem { Value = c.Name, Text = c.NativeName })
        .ToList();
}

<form asp-controller="Home"
      asp-action="SetLanguage"
      asp-route-returnUrl="@Context.Request.Path"
      method="post" 
      class="form-horizontal">
        <select class="form-select" 
            name="culture" onchange="this.form.submit();"
            asp-for="@requestCulture.RequestCulture.UICulture.Name"
            asp-items="cultureItems">
    </select>
</form>
