mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 19:26:39 +02:00
Add i18n support [WIP]
This commit is contained in:
27
Wox.Core/UI/ResourceMerger.cs
Normal file
27
Wox.Core/UI/ResourceMerger.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using Wox.Core.i18n;
|
||||
using Wox.Core.Theme;
|
||||
|
||||
namespace Wox.Core.UI
|
||||
{
|
||||
public class ResourceMerger
|
||||
{
|
||||
public static void ApplyResources()
|
||||
{
|
||||
var UIResourceType = typeof(IUIResource);
|
||||
var UIResources = AppDomain.CurrentDomain.GetAssemblies()
|
||||
.SelectMany(s => s.GetTypes())
|
||||
.Where(p => p.IsClass && !p.IsAbstract && UIResourceType.IsAssignableFrom(p));
|
||||
|
||||
Application.Current.Resources.MergedDictionaries.Clear();
|
||||
|
||||
foreach (var uiResource in UIResources)
|
||||
{
|
||||
Application.Current.Resources.MergedDictionaries.Add(
|
||||
((IUIResource)Activator.CreateInstance(uiResource)).GetResourceDictionary());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user