Resolved #312: Add language switch only if there are multiple languages.

pull/318/head
Halil ibrahim Kalkan 7 years ago
parent 37427ede2f
commit 74a34ea95c

@ -1,4 +1,8 @@
using System.Threading.Tasks;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Themes.Basic.Components.Toolbar.LanguageSwitch;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Themes.Basic.Components.Toolbar.UserMenu;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Toolbars;
@ -19,7 +23,13 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Toolbars
return Task.CompletedTask;
}
var requestLocalizationOptions = context.ServiceProvider.GetService<IOptions<RequestLocalizationOptions>>();
if (requestLocalizationOptions.Value.SupportedCultures.Count > 1)
{
context.Toolbar.Items.Add(new ToolbarItem(typeof(LanguageSwitchViewComponent)));
}
context.Toolbar.Items.Add(new ToolbarItem(typeof(UserMenuViewComponent)));
return Task.CompletedTask;

Loading…
Cancel
Save