mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-09 12:46:47 +02:00
update plugin languages
This commit is contained in:
8
Plugins/Wox.Plugin.CMD/Languages/zh-tw.xaml
Normal file
8
Plugins/Wox.Plugin.CMD/Languages/zh-tw.xaml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:system="clr-namespace:System;assembly=mscorlib">
|
||||||
|
|
||||||
|
<system:String x:Key="wox_plugin_cmd_relace_winr">替換 Win+R</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_cmd_leave_cmd_open">執行後不關閉命令窗口</system:String>
|
||||||
|
|
||||||
|
</ResourceDictionary>
|
||||||
24
Plugins/Wox.Plugin.Program/Languages/zh-tw.xaml
Normal file
24
Plugins/Wox.Plugin.Program/Languages/zh-tw.xaml
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:system="clr-namespace:System;assembly=mscorlib">
|
||||||
|
|
||||||
|
<!--Program setting-->
|
||||||
|
<system:String x:Key="wox_plugin_program_delete">刪除</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_program_edit">編輯</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_program_add">增加</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_program_location">位置</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_program_suffixes">索引文件後綴</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_program_reindex">重新索引</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_program_indexing">索引中</system:String>
|
||||||
|
|
||||||
|
|
||||||
|
<system:String x:Key="wox_plugin_program_pls_select_program_source">請先選擇一項</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_program_delete_program_source">你確定要刪除{0}嗎?</system:String>
|
||||||
|
|
||||||
|
<system:String x:Key="wox_plugin_program_update">更新</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_program_only_index_tip">Wox僅索引下列後綴的文件:</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_program_split_by_tip">(每個後綴以英文狀態下的分號分隔)</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_program_update_file_suffixes">成功更新索引文件後綴</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_program_suffixes_cannot_empty">文件後綴不能為空</system:String>
|
||||||
|
|
||||||
|
</ResourceDictionary>
|
||||||
15
Plugins/Wox.Plugin.Sys/Languages/en.xaml
Normal file
15
Plugins/Wox.Plugin.Sys/Languages/en.xaml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:system="clr-namespace:System;assembly=mscorlib">
|
||||||
|
|
||||||
|
<system:String x:Key="wox_plugin_sys_command">Command</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_sys_desc">Description</system:String>
|
||||||
|
|
||||||
|
<system:String x:Key="wox_plugin_sys_shutdown_computer">Shutdown Computer</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_sys_log_off">Log off</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_sys_lock">Lock this computer</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_sys_exit">Close Wox</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_sys_restart">Restart Wox</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_sys_setting">Tweak this app</system:String>
|
||||||
|
|
||||||
|
</ResourceDictionary>
|
||||||
15
Plugins/Wox.Plugin.Sys/Languages/zh-cn.xaml
Normal file
15
Plugins/Wox.Plugin.Sys/Languages/zh-cn.xaml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:system="clr-namespace:System;assembly=mscorlib">
|
||||||
|
|
||||||
|
<system:String x:Key="wox_plugin_sys_command">命令</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_sys_desc">描述</system:String>
|
||||||
|
|
||||||
|
<system:String x:Key="wox_plugin_sys_shutdown_computer">关闭电脑</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_sys_log_off">注销</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_sys_lock">锁定这台电脑</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_sys_exit">退出Wox</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_sys_restart">重启Wox</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_sys_setting">设置</system:String>
|
||||||
|
|
||||||
|
</ResourceDictionary>
|
||||||
15
Plugins/Wox.Plugin.Sys/Languages/zh-tw.xaml
Normal file
15
Plugins/Wox.Plugin.Sys/Languages/zh-tw.xaml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:system="clr-namespace:System;assembly=mscorlib">
|
||||||
|
|
||||||
|
<system:String x:Key="wox_plugin_sys_command">命令</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_sys_desc">描述</system:String>
|
||||||
|
|
||||||
|
<system:String x:Key="wox_plugin_sys_shutdown_computer">關閉電腦</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_sys_log_off">註銷</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_sys_lock">鎖定這臺電腦</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_sys_exit">退出Wox</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_sys_restart">重啟Wox</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_sys_setting">設置</system:String>
|
||||||
|
|
||||||
|
</ResourceDictionary>
|
||||||
@@ -1,13 +1,16 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
|
using System.Reflection;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace Wox.Plugin.Sys
|
namespace Wox.Plugin.Sys
|
||||||
{
|
{
|
||||||
public class Sys : IPlugin, ISettingProvider
|
public class Sys : IPlugin, ISettingProvider ,IPluginI18n
|
||||||
{
|
{
|
||||||
List<Result> availableResults = new List<Result>();
|
List<Result> availableResults = new List<Result>();
|
||||||
|
private PluginInitContext context;
|
||||||
|
|
||||||
#region DllImport
|
#region DllImport
|
||||||
|
|
||||||
@@ -32,9 +35,12 @@ namespace Wox.Plugin.Sys
|
|||||||
public List<Result> Query(Query query)
|
public List<Result> Query(Query query)
|
||||||
{
|
{
|
||||||
if (query.RawQuery.EndsWith(" ") || query.RawQuery.Length <= 1) return new List<Result>();
|
if (query.RawQuery.EndsWith(" ") || query.RawQuery.Length <= 1) return new List<Result>();
|
||||||
|
if (availableResults.Count == 0)
|
||||||
|
{
|
||||||
|
LoadCommands();
|
||||||
|
}
|
||||||
|
|
||||||
List<Result> results = new List<Result>();
|
List<Result> results = new List<Result>();
|
||||||
|
|
||||||
foreach (Result availableResult in availableResults)
|
foreach (Result availableResult in availableResults)
|
||||||
{
|
{
|
||||||
if (availableResult.Title.ToLower().StartsWith(query.RawQuery.ToLower()))
|
if (availableResult.Title.ToLower().StartsWith(query.RawQuery.ToLower()))
|
||||||
@@ -47,11 +53,16 @@ namespace Wox.Plugin.Sys
|
|||||||
|
|
||||||
public void Init(PluginInitContext context)
|
public void Init(PluginInitContext context)
|
||||||
{
|
{
|
||||||
availableResults.AddRange(new Result[] {
|
this.context = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadCommands()
|
||||||
|
{
|
||||||
|
availableResults.AddRange(new Result[] {
|
||||||
new Result
|
new Result
|
||||||
{
|
{
|
||||||
Title = "Shutdown",
|
Title = "Shutdown",
|
||||||
SubTitle = "Shutdown Computer",
|
SubTitle = context.API.GetTranslation("wox_plugin_sys_shutdown_computer"),
|
||||||
Score = 100,
|
Score = 100,
|
||||||
IcoPath = "Images\\exit.png",
|
IcoPath = "Images\\exit.png",
|
||||||
Action = (c) =>
|
Action = (c) =>
|
||||||
@@ -65,7 +76,7 @@ namespace Wox.Plugin.Sys
|
|||||||
new Result
|
new Result
|
||||||
{
|
{
|
||||||
Title = "Log off",
|
Title = "Log off",
|
||||||
SubTitle = "Log off current user",
|
SubTitle = context.API.GetTranslation("wox_plugin_sys_log_off"),
|
||||||
Score = 100,
|
Score = 100,
|
||||||
IcoPath = "Images\\logoff.png",
|
IcoPath = "Images\\logoff.png",
|
||||||
Action = (c) => ExitWindowsEx(EWX_LOGOFF, 0)
|
Action = (c) => ExitWindowsEx(EWX_LOGOFF, 0)
|
||||||
@@ -73,7 +84,7 @@ namespace Wox.Plugin.Sys
|
|||||||
new Result
|
new Result
|
||||||
{
|
{
|
||||||
Title = "Lock",
|
Title = "Lock",
|
||||||
SubTitle = "Lock this computer",
|
SubTitle = context.API.GetTranslation("wox_plugin_sys_lock"),
|
||||||
Score = 100,
|
Score = 100,
|
||||||
IcoPath = "Images\\lock.png",
|
IcoPath = "Images\\lock.png",
|
||||||
Action = (c) =>
|
Action = (c) =>
|
||||||
@@ -85,7 +96,7 @@ namespace Wox.Plugin.Sys
|
|||||||
new Result
|
new Result
|
||||||
{
|
{
|
||||||
Title = "Exit",
|
Title = "Exit",
|
||||||
SubTitle = "Close this app",
|
SubTitle = context.API.GetTranslation("wox_plugin_sys_exit"),
|
||||||
Score = 110,
|
Score = 110,
|
||||||
IcoPath = "Images\\app.png",
|
IcoPath = "Images\\app.png",
|
||||||
Action = (c) =>
|
Action = (c) =>
|
||||||
@@ -97,7 +108,7 @@ namespace Wox.Plugin.Sys
|
|||||||
new Result
|
new Result
|
||||||
{
|
{
|
||||||
Title = "Restart Wox",
|
Title = "Restart Wox",
|
||||||
SubTitle = "Restart Wox",
|
SubTitle = context.API.GetTranslation("wox_plugin_sys_restart"),
|
||||||
Score = 110,
|
Score = 110,
|
||||||
IcoPath = "Images\\restart.png",
|
IcoPath = "Images\\restart.png",
|
||||||
Action = (c) =>
|
Action = (c) =>
|
||||||
@@ -115,7 +126,7 @@ namespace Wox.Plugin.Sys
|
|||||||
new Result
|
new Result
|
||||||
{
|
{
|
||||||
Title = "Settings",
|
Title = "Settings",
|
||||||
SubTitle = "Tweak this app",
|
SubTitle = context.API.GetTranslation("wox_plugin_sys_setting"),
|
||||||
Score = 100,
|
Score = 100,
|
||||||
IcoPath = "Images\\app.png",
|
IcoPath = "Images\\app.png",
|
||||||
Action = (c) =>
|
Action = (c) =>
|
||||||
@@ -127,7 +138,10 @@ namespace Wox.Plugin.Sys
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string GetLanguagesFolder()
|
||||||
|
{
|
||||||
|
return Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Languages");
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,14 +9,14 @@
|
|||||||
<ListView x:Name="lbxCommands" Grid.Row="0">
|
<ListView x:Name="lbxCommands" Grid.Row="0">
|
||||||
<ListView.View>
|
<ListView.View>
|
||||||
<GridView>
|
<GridView>
|
||||||
<GridViewColumn Header="Command" Width="150">
|
<GridViewColumn Header="{DynamicResource wox_plugin_sys_command}" Width="150">
|
||||||
<GridViewColumn.CellTemplate>
|
<GridViewColumn.CellTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<TextBlock Text="{Binding Title}"/>
|
<TextBlock Text="{Binding Title}"/>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</GridViewColumn.CellTemplate>
|
</GridViewColumn.CellTemplate>
|
||||||
</GridViewColumn>
|
</GridViewColumn>
|
||||||
<GridViewColumn Header="Description" Width="Auto">
|
<GridViewColumn Header="{DynamicResource wox_plugin_sys_desc}" Width="Auto">
|
||||||
<GridViewColumn.CellTemplate>
|
<GridViewColumn.CellTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<TextBlock Text="{Binding SubTitle}"/>
|
<TextBlock Text="{Binding SubTitle}"/>
|
||||||
|
|||||||
@@ -64,6 +64,21 @@
|
|||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Content Include="Languages\en.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<None Include="Languages\zh-cn.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Languages\zh-tw.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
<Page Include="SysSettings.xaml">
|
<Page Include="SysSettings.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using System.Linq;
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Wox.Core.Exception;
|
using Wox.Core.Exception;
|
||||||
|
using Wox.Core.UI;
|
||||||
using Wox.Core.UserSettings;
|
using Wox.Core.UserSettings;
|
||||||
using Wox.Infrastructure;
|
using Wox.Infrastructure;
|
||||||
using Wox.Infrastructure.Http;
|
using Wox.Infrastructure.Http;
|
||||||
@@ -91,6 +92,9 @@ namespace Wox.Core.Plugin
|
|||||||
plugins.AddRange(new CSharpPluginLoader().LoadPlugin(pluginMetadatas));
|
plugins.AddRange(new CSharpPluginLoader().LoadPlugin(pluginMetadatas));
|
||||||
plugins.AddRange(new JsonRPCPluginLoader<PythonPlugin>().LoadPlugin(pluginMetadatas));
|
plugins.AddRange(new JsonRPCPluginLoader<PythonPlugin>().LoadPlugin(pluginMetadatas));
|
||||||
|
|
||||||
|
//load plugin i18n languages
|
||||||
|
ResourceMerger.ApplyPluginLanguages();
|
||||||
|
|
||||||
foreach (PluginPair pluginPair in plugins)
|
foreach (PluginPair pluginPair in plugins)
|
||||||
{
|
{
|
||||||
PluginPair pair = pluginPair;
|
PluginPair pair = pluginPair;
|
||||||
|
|||||||
@@ -13,10 +13,10 @@ namespace Wox.Core.UI
|
|||||||
{
|
{
|
||||||
Application.Current.Resources.MergedDictionaries.Clear();
|
Application.Current.Resources.MergedDictionaries.Clear();
|
||||||
ApplyPluginLanguages();
|
ApplyPluginLanguages();
|
||||||
ApplyUIResources();
|
ApplyThemeAndLanguageResources();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ApplyUIResources()
|
private static void ApplyThemeAndLanguageResources()
|
||||||
{
|
{
|
||||||
var UIResourceType = typeof(IUIResource);
|
var UIResourceType = typeof(IUIResource);
|
||||||
var UIResources = AppDomain.CurrentDomain.GetAssemblies()
|
var UIResources = AppDomain.CurrentDomain.GetAssemblies()
|
||||||
@@ -30,7 +30,7 @@ namespace Wox.Core.UI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ApplyPluginLanguages()
|
public static void ApplyPluginLanguages()
|
||||||
{
|
{
|
||||||
var pluginI18nType = typeof(IPluginI18n);
|
var pluginI18nType = typeof(IPluginI18n);
|
||||||
var pluginI18ns = AppDomain.CurrentDomain.GetAssemblies()
|
var pluginI18ns = AppDomain.CurrentDomain.GetAssemblies()
|
||||||
|
|||||||
Reference in New Issue
Block a user