mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 03:36:44 +02:00
Add plugin title translations
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.7 KiB |
11
Plugins/Wox.Plugin.Url/Languages/en.xaml
Normal file
11
Plugins/Wox.Plugin.Url/Languages/en.xaml
Normal file
@@ -0,0 +1,11 @@
|
||||
<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_url_open_url">Open url:{0}</system:String>
|
||||
<system:String x:Key="wox_plugin_url_canot_open_url">Can't open url:{0}</system:String>
|
||||
|
||||
<system:String x:Key="wox_plugin_url_plugin_name">URL</system:String>
|
||||
<system:String x:Key="wox_plugin_url_plugin_description">Open the typed URL from Wox</system:String>
|
||||
|
||||
</ResourceDictionary>
|
||||
11
Plugins/Wox.Plugin.Url/Languages/zh-cn.xaml
Normal file
11
Plugins/Wox.Plugin.Url/Languages/zh-cn.xaml
Normal file
@@ -0,0 +1,11 @@
|
||||
<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_url_open_url">打开链接:{0}</system:String>
|
||||
<system:String x:Key="wox_plugin_url_canot_open_url">无法打开链接:{0}</system:String>
|
||||
|
||||
<system:String x:Key="wox_plugin_url_plugin_name">URL</system:String>
|
||||
<system:String x:Key="wox_plugin_url_plugin_description">从Wox打开链接</system:String>
|
||||
|
||||
</ResourceDictionary>
|
||||
11
Plugins/Wox.Plugin.Url/Languages/zh-tw.xaml
Normal file
11
Plugins/Wox.Plugin.Url/Languages/zh-tw.xaml
Normal file
@@ -0,0 +1,11 @@
|
||||
<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_url_open_url">打開鏈接:{0}</system:String>
|
||||
<system:String x:Key="wox_plugin_url_canot_open_url">無法打開鏈接:{0}</system:String>
|
||||
|
||||
<system:String x:Key="wox_plugin_url_plugin_name">URL</system:String>
|
||||
<system:String x:Key="wox_plugin_url_plugin_description">從Wox打開鏈接</system:String>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -1,15 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows;
|
||||
|
||||
namespace Wox.Plugin.Url
|
||||
{
|
||||
public class UrlPlugin : IPlugin
|
||||
public class UrlPlugin : IPlugin, IPluginI18n
|
||||
{
|
||||
//based on https://gist.github.com/dperini/729294
|
||||
private const string urlPattern ="^" +
|
||||
private const string urlPattern = "^" +
|
||||
// protocol identifier
|
||||
"(?:(?:https?|ftp)://|)" +
|
||||
// user:pass authentication
|
||||
@@ -42,6 +44,7 @@ namespace Wox.Plugin.Url
|
||||
"(?:/\\S*)?" +
|
||||
"$";
|
||||
Regex reg = new Regex(urlPattern, RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
private PluginInitContext context;
|
||||
|
||||
public List<Result> Query(Query query)
|
||||
{
|
||||
@@ -53,7 +56,7 @@ namespace Wox.Plugin.Url
|
||||
new Result
|
||||
{
|
||||
Title = raw,
|
||||
SubTitle = "Open " + raw,
|
||||
SubTitle = string.Format(context.API.GetTranslation("wox_plugin_url_open_url"),raw),
|
||||
IcoPath = "Images/url.png",
|
||||
Score = 8,
|
||||
Action = _ =>
|
||||
@@ -69,7 +72,7 @@ namespace Wox.Plugin.Url
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Could not open " + raw);
|
||||
context.API.ShowMsg(string.Format(context.API.GetTranslation("wox_plugin_url_canot_open_url"), raw));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -98,7 +101,22 @@ namespace Wox.Plugin.Url
|
||||
|
||||
public void Init(PluginInitContext context)
|
||||
{
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public string GetLanguagesFolder()
|
||||
{
|
||||
return Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Languages");
|
||||
}
|
||||
|
||||
public string GetTranslatedPluginTitle()
|
||||
{
|
||||
return context.API.GetTranslation("wox_plugin_url_plugin_name");
|
||||
}
|
||||
|
||||
public string GetTranslatedPluginDescription()
|
||||
{
|
||||
return context.API.GetTranslation("wox_plugin_url_plugin_description");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -64,6 +64,27 @@
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Languages\en.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Languages\zh-cn.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Languages\zh-tw.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"ID":"0308FD86DE0A4DEE8D62B9B535370992",
|
||||
"ActionKeyword":"*",
|
||||
"Name":"URL handler",
|
||||
"Description":"Provide Opening the typed URL from Wox.",
|
||||
"Name":"URL",
|
||||
"Description":"Open the typed URL from Wox",
|
||||
"Author":"qianlifeng",
|
||||
"Version":"1.0.0",
|
||||
"Language":"csharp",
|
||||
|
||||
Reference in New Issue
Block a user