diff --git a/DotNetRu.Clients.UI/AppShell.xaml b/DotNetRu.Clients.UI/AppShell.xaml index bd518245..7778aef6 100644 --- a/DotNetRu.Clients.UI/AppShell.xaml +++ b/DotNetRu.Clients.UI/AppShell.xaml @@ -26,24 +26,28 @@ diff --git a/DotNetRu.Clients.UI/AppShell.xaml.cs b/DotNetRu.Clients.UI/AppShell.xaml.cs index 520020c7..90ed81ec 100644 --- a/DotNetRu.Clients.UI/AppShell.xaml.cs +++ b/DotNetRu.Clients.UI/AppShell.xaml.cs @@ -1,3 +1,6 @@ +using DotNetRu.Clients.Portable.Helpers; +using DotNetRu.Clients.Portable.ViewModel; +using DotNetRu.Utils.Helpers; using Xamarin.Forms; namespace DotNetRu.Clients.UI @@ -15,6 +18,22 @@ public AppShell() // Can't set BackgrounColor as StaticResource, see https://github.com/xamarin/Xamarin.Forms/issues/7055 SetBackgroundColor(this, backgroundColor); + + MessagingCenter.Subscribe(this, MessageKeys.LanguageChanged, sender => this.UpdateTabBarLocalization()); + } + + public void UpdateTabBarLocalization() + { + Device.BeginInvokeOnMainThread(() => + { + if (this.BindingContext is ViewModelBase viewModel) + { + this.NewsTab.Title = viewModel.Resources["News"] ?? this.NewsTab.Title; + this.SpeakersTab.Title = viewModel.Resources["Speakers"] ?? this.SpeakersTab.Title; + this.MeetupsTab.Title = viewModel.Resources["Meetups"] ?? this.MeetupsTab.Title; + this.AboutTab.Title = viewModel.Resources["About"] ?? this.AboutTab.Title; + } + }); } } }