mirror of
https://github.com/sp-tarkov/launcher.git
synced 2025-02-13 09:50:43 -05:00
49 lines
1.3 KiB
C#
49 lines
1.3 KiB
C#
![]() |
/* LocaleCollection.cs
|
||
|
* License: NCSA Open Source License
|
||
|
*
|
||
|
* Copyright: Merijn Hendriks
|
||
|
* AUTHORS:
|
||
|
* waffle.lord
|
||
|
*/
|
||
|
|
||
|
|
||
|
using Aki.Launcher.Helpers;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Collections.ObjectModel;
|
||
|
using System.ComponentModel;
|
||
|
|
||
|
namespace Aki.Launcher.Models.Launcher
|
||
|
{
|
||
|
public class LocaleCollection : INotifyPropertyChanged
|
||
|
{
|
||
|
private string _SelectedLocale;
|
||
|
public string SelectedLocale
|
||
|
{
|
||
|
get => _SelectedLocale;
|
||
|
set
|
||
|
{
|
||
|
if (_SelectedLocale != value)
|
||
|
{
|
||
|
_SelectedLocale = value;
|
||
|
RaisePropertyChanged(nameof(SelectedLocale));
|
||
|
LocalizationProvider.LoadLocaleFromFile(value);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public ObservableCollection<string> AvailableLocales { get; set; } = LocalizationProvider.GetAvailableLocales();
|
||
|
|
||
|
public event PropertyChangedEventHandler PropertyChanged;
|
||
|
|
||
|
public LocaleCollection()
|
||
|
{
|
||
|
SelectedLocale = LocalizationProvider.LocaleNameDictionary.GetValueOrDefault(LauncherSettingsProvider.Instance.DefaultLocale, "English");
|
||
|
}
|
||
|
|
||
|
protected virtual void RaisePropertyChanged(string property)
|
||
|
{
|
||
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(property));
|
||
|
}
|
||
|
}
|
||
|
}
|