bloxstrap/Bloxstrap/UI/ViewModels/Dialogs/LanguageSelectorViewModel.cs
pizzaboxer 3d3684c248
Rework locale handler and fix remaining RTL issues
window handler was being duplicated, wouldn't apply for system default language nor on initial installation, winforms progress bar not following RTL changes
2024-07-03 12:08:46 +04:00

33 lines
869 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
using CommunityToolkit.Mvvm.Input;
namespace Bloxstrap.UI.ViewModels.Dialogs
{
internal class LanguageSelectorViewModel
{
public event EventHandler? CloseRequestEvent;
public ICommand SetLocaleCommand => new RelayCommand(SetLocale);
public static List<string> Languages => Locale.GetLanguages();
public string SelectedLanguage { get; set; } = Locale.SupportedLocales[App.Settings.Prop.Locale];
private void SetLocale()
{
string identifier = Locale.GetIdentifierFromName(SelectedLanguage);
Locale.Set(identifier);
App.Settings.Prop.Locale = identifier;
CloseRequestEvent?.Invoke(this, new());
}
}
}