@namespace Oqtane.Themes.Controls
@inherits ThemeControlBase
@using System.Globalization
@inject ILocalizationService LocalizationService
@inject NavigationManager NavigationManager
@if (_supportedCultures != null)
{
}
@code{
private string _selectedCulture;
private string[] _supportedCultures;
protected override async Task OnParametersSetAsync()
{
var interop = new Interop(JSRuntime);
_selectedCulture = await interop.GetLocalStorage("OqtaneCulture");
_supportedCultures = await LocalizationService.GetSupportedCultures();
}
private async Task SetCultureAsync(string culture)
{
if (culture != CultureInfo.CurrentUICulture.Name)
{
var interop = new Interop(JSRuntime);
await interop.SetLocalStorage("OqtaneCulture", culture);
NavigationManager.NavigateTo(NavigationManager.Uri, forceLoad: true);
}
}
}