mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 19:26:39 +02:00
Use variable instead of global static method
1. introduce variable 2. part of #389 3. refactoring program suffix in program plugin 4. 全局变量一时爽,代码重构火葬场
This commit is contained in:
@@ -12,6 +12,8 @@ namespace Wox.Core.Resource
|
||||
{
|
||||
public class Internationalization : Resource
|
||||
{
|
||||
public UserSettingStorage Settings { get; set; }
|
||||
|
||||
public Internationalization()
|
||||
{
|
||||
DirectoryName = "Languages";
|
||||
@@ -64,8 +66,8 @@ namespace Wox.Core.Resource
|
||||
}
|
||||
}
|
||||
|
||||
UserSettingStorage.Instance.Language = language.LanguageCode;
|
||||
UserSettingStorage.Instance.Save();
|
||||
Settings.Language = language.LanguageCode;
|
||||
Settings.Save();
|
||||
ResourceMerger.UpdateResource(this);
|
||||
}
|
||||
|
||||
@@ -137,7 +139,7 @@ namespace Wox.Core.Resource
|
||||
{
|
||||
if (!Directory.Exists(folder)) return string.Empty;
|
||||
|
||||
string path = Path.Combine(folder, UserSettingStorage.Instance.Language + ".xaml");
|
||||
string path = Path.Combine(folder, Settings.Language + ".xaml");
|
||||
if (File.Exists(path))
|
||||
{
|
||||
return path;
|
||||
|
||||
Reference in New Issue
Block a user