mirror of
https://github.com/2dust/v2rayN.git
synced 2025-08-30 06:46:19 +00:00
修改语言不再需要重启
This commit is contained in:
parent
05d446ed37
commit
08943586ac
7 changed files with 18 additions and 7 deletions
2
v2rayN/ServiceLib/Resx/ResUI.Designer.cs
generated
2
v2rayN/ServiceLib/Resx/ResUI.Designer.cs
generated
|
@ -3131,7 +3131,7 @@ namespace ServiceLib.Resx {
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Language (Restart) 的本地化字符串。
|
||||
/// 查找类似 Language 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string TbSettingsLanguage {
|
||||
get {
|
||||
|
|
|
@ -488,7 +488,7 @@
|
|||
<value>Follow System Theme</value>
|
||||
</data>
|
||||
<data name="TbSettingsLanguage" xml:space="preserve">
|
||||
<value>Language (Restart)</value>
|
||||
<value>Language</value>
|
||||
</data>
|
||||
<data name="menuAddServerViaClipboard" xml:space="preserve">
|
||||
<value>Import Share Links from clipboard (Ctrl+V)</value>
|
||||
|
|
|
@ -488,7 +488,7 @@
|
|||
<value>Следить за системной темой</value>
|
||||
</data>
|
||||
<data name="TbSettingsLanguage" xml:space="preserve">
|
||||
<value>Язык (требуется перезапуск)</value>
|
||||
<value>Язык</value>
|
||||
</data>
|
||||
<data name="menuAddServerViaClipboard" xml:space="preserve">
|
||||
<value>Импорт массива URL из буфера обмена (Ctrl+V)</value>
|
||||
|
|
|
@ -488,7 +488,7 @@
|
|||
<value>是否跟随系统主题</value>
|
||||
</data>
|
||||
<data name="TbSettingsLanguage" xml:space="preserve">
|
||||
<value>语言(重启)</value>
|
||||
<value>语言</value>
|
||||
</data>
|
||||
<data name="menuAddServerViaClipboard" xml:space="preserve">
|
||||
<value>从剪贴板导入分享链接 (Ctrl+V)</value>
|
||||
|
|
|
@ -487,7 +487,7 @@
|
|||
<value>是否跟隨系統主題</value>
|
||||
</data>
|
||||
<data name="TbSettingsLanguage" xml:space="preserve">
|
||||
<value>語言(重啟)</value>
|
||||
<value>語言</value>
|
||||
</data>
|
||||
<data name="menuAddServerViaClipboard" xml:space="preserve">
|
||||
<value>從剪貼簿導入分享鏈接 (Ctrl+V)</value>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.ApplicationLifetimes;
|
||||
using Avalonia.Controls.Notifications;
|
||||
using Avalonia.Controls.Primitives;
|
||||
using Avalonia.Media;
|
||||
|
@ -7,6 +8,7 @@ using Avalonia.Styling;
|
|||
using ReactiveUI;
|
||||
using ReactiveUI.Fody.Helpers;
|
||||
using System.Reactive.Linq;
|
||||
using v2rayN.Desktop.Views;
|
||||
|
||||
namespace v2rayN.Desktop.ViewModels
|
||||
{
|
||||
|
@ -86,7 +88,11 @@ namespace v2rayN.Desktop.ViewModels
|
|||
_config.UiItem.CurrentLanguage = CurrentLanguage;
|
||||
Thread.CurrentThread.CurrentUICulture = new(CurrentLanguage);
|
||||
ConfigHandler.SaveConfig(_config);
|
||||
NoticeHandler.Instance.Enqueue(ResUI.NeedRebootTips);
|
||||
|
||||
Window oldMainWindow = (Application.Current!.ApplicationLifetime as IClassicDesktopStyleApplicationLifetime)!.MainWindow!;
|
||||
(Application.Current!.ApplicationLifetime as IClassicDesktopStyleApplicationLifetime)!.MainWindow = new MainWindow();
|
||||
oldMainWindow.Close();
|
||||
(Application.Current!.ApplicationLifetime as IClassicDesktopStyleApplicationLifetime)!.MainWindow!.Show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ using System.Reactive.Linq;
|
|||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
using System.Windows.Interop;
|
||||
using v2rayN.Views;
|
||||
|
||||
namespace v2rayN.ViewModels
|
||||
{
|
||||
|
@ -143,7 +144,11 @@ namespace v2rayN.ViewModels
|
|||
_config.UiItem.CurrentLanguage = CurrentLanguage;
|
||||
Thread.CurrentThread.CurrentUICulture = new(CurrentLanguage);
|
||||
ConfigHandler.SaveConfig(_config);
|
||||
NoticeHandler.Instance.Enqueue(ResUI.NeedRebootTips);
|
||||
|
||||
Window oldMainWindow = Application.Current.MainWindow;
|
||||
Application.Current.MainWindow = new MainWindow();
|
||||
oldMainWindow.Close();
|
||||
Application.Current.MainWindow.Show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue