mirror of
https://github.com/2dust/v2rayN.git
synced 2026-09-13 18:02:07 +03:00
Show language names in theme settings
This commit is contained in:
@@ -489,17 +489,22 @@ public class Global
|
||||
"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 =
|
||||
[
|
||||
"zh-Hans",
|
||||
"zh-Hant",
|
||||
"en",
|
||||
"fa",
|
||||
"fr",
|
||||
"ru",
|
||||
"hu",
|
||||
"id",
|
||||
"az"
|
||||
.. LanguageOptions.Select(t => t.Value)
|
||||
];
|
||||
|
||||
public static readonly List<string> Alpns =
|
||||
|
||||
3
v2rayN/ServiceLib/Models/Dto/LanguageOption.cs
Normal file
3
v2rayN/ServiceLib/Models/Dto/LanguageOption.cs
Normal file
@@ -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;
|
||||
|
||||
namespace v2rayN.Desktop.Views;
|
||||
@@ -14,7 +15,9 @@ public partial class ThemeSettingView : ReactiveUserControl<ThemeSettingViewMode
|
||||
|
||||
cmbCurrentTheme.ItemsSource = Utils.GetEnumNames<ETheme>();
|
||||
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 =>
|
||||
{
|
||||
|
||||
@@ -81,6 +81,8 @@
|
||||
Grid.Column="1"
|
||||
Width="120"
|
||||
Margin="{StaticResource Margin8}"
|
||||
DisplayMemberPath="Display"
|
||||
SelectedValuePath="Value"
|
||||
Style="{StaticResource DefComboBox}" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
|
||||
@@ -14,7 +14,7 @@ public partial class ThemeSettingView
|
||||
|
||||
cmbCurrentTheme.ItemsSource = Utils.GetEnumNames<ETheme>().Take(3).ToList();
|
||||
cmbCurrentFontSize.ItemsSource = Enumerable.Range(Global.MinFontSize, Global.MinFontSizeCount).ToList();
|
||||
cmbCurrentLanguage.ItemsSource = Global.Languages;
|
||||
cmbCurrentLanguage.ItemsSource = Global.LanguageOptions;
|
||||
|
||||
this.WhenActivated(disposables =>
|
||||
{
|
||||
@@ -22,7 +22,7 @@ public partial class ThemeSettingView
|
||||
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.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