mirror of
https://github.com/2dust/v2rayN.git
synced 2026-09-22 22:38:10 +03:00
Show language names in theme settings
This commit is contained in:
@@ -489,17 +489,22 @@ public class Global
|
|||||||
"localhost"
|
"localhost"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
public static readonly List<LanguageOption> LanguageOptions =
|
||||||
|
[
|
||||||
|
new("zh-Hans", "简体中文"),
|
||||||
|
new("zh-Hant", "繁體中文"),
|
||||||
|
new("en", "English"),
|
||||||
|
new("fa", "فارسی"),
|
||||||
|
new("fr", "Français"),
|
||||||
|
new("ru", "Русский"),
|
||||||
|
new("hu", "Magyar"),
|
||||||
|
new("id", "Bahasa Indonesia"),
|
||||||
|
new("az", "Azərbaycan dili")
|
||||||
|
];
|
||||||
|
|
||||||
public static readonly List<string> Languages =
|
public static readonly List<string> Languages =
|
||||||
[
|
[
|
||||||
"zh-Hans",
|
.. LanguageOptions.Select(t => t.Value)
|
||||||
"zh-Hant",
|
|
||||||
"en",
|
|
||||||
"fa",
|
|
||||||
"fr",
|
|
||||||
"ru",
|
|
||||||
"hu",
|
|
||||||
"id",
|
|
||||||
"az"
|
|
||||||
];
|
];
|
||||||
|
|
||||||
public static readonly List<string> Alpns =
|
public static readonly List<string> Alpns =
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
namespace ServiceLib.Models.Dto;
|
||||||
|
|
||||||
|
public sealed record LanguageOption(string Value, string Display);
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using Avalonia.Data;
|
||||||
using v2rayN.Desktop.ViewModels;
|
using v2rayN.Desktop.ViewModels;
|
||||||
|
|
||||||
namespace v2rayN.Desktop.Views;
|
namespace v2rayN.Desktop.Views;
|
||||||
@@ -14,7 +15,9 @@ public partial class ThemeSettingView : ReactiveUserControl<ThemeSettingViewMode
|
|||||||
|
|
||||||
cmbCurrentTheme.ItemsSource = Utils.GetEnumNames<ETheme>();
|
cmbCurrentTheme.ItemsSource = Utils.GetEnumNames<ETheme>();
|
||||||
cmbCurrentFontSize.ItemsSource = Enumerable.Range(Global.MinFontSize, Global.MinFontSizeCount).ToList();
|
cmbCurrentFontSize.ItemsSource = Enumerable.Range(Global.MinFontSize, Global.MinFontSizeCount).ToList();
|
||||||
cmbCurrentLanguage.ItemsSource = Global.Languages;
|
cmbCurrentLanguage.ItemsSource = Global.LanguageOptions;
|
||||||
|
cmbCurrentLanguage.DisplayMemberBinding = new Binding(nameof(LanguageOption.Display));
|
||||||
|
cmbCurrentLanguage.SelectedValueBinding = new Binding(nameof(LanguageOption.Value));
|
||||||
|
|
||||||
this.WhenActivated(disposables =>
|
this.WhenActivated(disposables =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -81,6 +81,8 @@
|
|||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Width="120"
|
Width="120"
|
||||||
Margin="{StaticResource Margin8}"
|
Margin="{StaticResource Margin8}"
|
||||||
|
DisplayMemberPath="Display"
|
||||||
|
SelectedValuePath="Value"
|
||||||
Style="{StaticResource DefComboBox}" />
|
Style="{StaticResource DefComboBox}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ public partial class ThemeSettingView
|
|||||||
|
|
||||||
cmbCurrentTheme.ItemsSource = Utils.GetEnumNames<ETheme>().Take(3).ToList();
|
cmbCurrentTheme.ItemsSource = Utils.GetEnumNames<ETheme>().Take(3).ToList();
|
||||||
cmbCurrentFontSize.ItemsSource = Enumerable.Range(Global.MinFontSize, Global.MinFontSizeCount).ToList();
|
cmbCurrentFontSize.ItemsSource = Enumerable.Range(Global.MinFontSize, Global.MinFontSizeCount).ToList();
|
||||||
cmbCurrentLanguage.ItemsSource = Global.Languages;
|
cmbCurrentLanguage.ItemsSource = Global.LanguageOptions;
|
||||||
|
|
||||||
this.WhenActivated(disposables =>
|
this.WhenActivated(disposables =>
|
||||||
{
|
{
|
||||||
@@ -22,7 +22,7 @@ public partial class ThemeSettingView
|
|||||||
this.OneWayBind(ViewModel, vm => vm.Swatches, v => v.cmbSwatches.ItemsSource).DisposeWith(disposables);
|
this.OneWayBind(ViewModel, vm => vm.Swatches, v => v.cmbSwatches.ItemsSource).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.SelectedSwatch, v => v.cmbSwatches.SelectedItem).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.SelectedSwatch, v => v.cmbSwatches.SelectedItem).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.CurrentFontSize, v => v.cmbCurrentFontSize.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.CurrentFontSize, v => v.cmbCurrentFontSize.Text).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.CurrentLanguage, v => v.cmbCurrentLanguage.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.CurrentLanguage, v => v.cmbCurrentLanguage.SelectedValue).DisposeWith(disposables);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user