Add translations for Program plugin.

This commit is contained in:
qianlifeng 2015-01-06 23:24:11 +08:00
parent ce9c832e00
commit 492e33aeda
14 changed files with 223 additions and 172 deletions

View File

@ -2,6 +2,22 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="wox_plugin_porgram_delete">Delete</system:String>
<!--Program setting-->
<system:String x:Key="wox_plugin_program_delete">Delete</system:String>
<system:String x:Key="wox_plugin_program_edit">Edit</system:String>
<system:String x:Key="wox_plugin_program_add">Add</system:String>
<system:String x:Key="wox_plugin_program_location">Location</system:String>
<system:String x:Key="wox_plugin_program_suffixes">Index file suffixes</system:String>
<system:String x:Key="wox_plugin_program_reindex">Reindex</system:String>
<system:String x:Key="wox_plugin_program_indexing">Indexing</system:String>
<system:String x:Key="wox_plugin_program_pls_select_program_source">Please select a program source</system:String>
<system:String x:Key="wox_plugin_program_delete_program_source">Are your sure to delete {0}?</system:String>
<system:String x:Key="wox_plugin_program_update">Update</system:String>
<system:String x:Key="wox_plugin_program_only_index_tip">Wox will only index files that end with following suffixes:</system:String>
<system:String x:Key="wox_plugin_program_split_by_tip">(Each suffix should split by ;)</system:String>
<system:String x:Key="wox_plugin_program_update_file_suffixes">Sucessfully update file suffixes</system:String>
<system:String x:Key="wox_plugin_program_suffixes_cannot_empty">File suffixes can't be empty</system:String>
</ResourceDictionary>

View 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>

View File

@ -3,14 +3,9 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:infrastructure="clr-namespace:Wox.Infrastructure;assembly=Wox.Infrastructure"
xmlns:program="clr-namespace:Wox.Plugin.Program"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="600">
<UserControl.Resources>
<BooleanToVisibilityConverter x:Key="BoolToVis" />
</UserControl.Resources>
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="50"/>
@ -18,13 +13,13 @@
<RowDefinition Height="50"/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Orientation="Horizontal" HorizontalAlignment="Right">
<Button Height="30" HorizontalAlignment="Right" x:Name="btnProgramSuffixes" Width="130" Click="BtnProgramSuffixes_OnClick">Index file suffixes</Button>
<Button Height="30" HorizontalAlignment="Right" Margin="10 0 0 0" x:Name="btnReindex" Width="100" Click="btnReindex_Click">Re-Index</Button>
<Button Height="30" HorizontalAlignment="Right" x:Name="btnProgramSuffixes" Width="130" Click="BtnProgramSuffixes_OnClick" Content="{DynamicResource wox_plugin_program_suffixes}"></Button>
<Button Height="30" HorizontalAlignment="Right" Margin="10 0 0 0" x:Name="btnReindex" Width="100" Click="btnReindex_Click" Content="{DynamicResource wox_plugin_program_reindex}"></Button>
</StackPanel>
<ListView x:Name="programSourceView" Grid.Row="1">
<ListView.View>
<GridView>
<GridViewColumn Header="Location" Width="400">
<GridViewColumn Header="{DynamicResource wox_plugin_program_location}" Width="400">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Location, ConverterParameter=(null), Converter={program:StringEmptyConverter}}"/>
@ -37,12 +32,12 @@
<DockPanel Grid.Row="2">
<StackPanel x:Name="indexingPanel" Visibility="Hidden" HorizontalAlignment="Left" Orientation="Horizontal">
<ProgressBar x:Name="progressBarIndexing" Height="20" Width="80" Minimum="0" Maximum="100" IsIndeterminate="True"></ProgressBar>
<TextBlock Margin="10 0 0 0" Height="20" HorizontalAlignment="Center">Indexing</TextBlock>
<TextBlock Margin="10 0 0 0" Height="20" HorizontalAlignment="Center" Text="{DynamicResource wox_plugin_program_indexing}"></TextBlock>
</StackPanel>
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
<Button x:Name="btnDeleteProgramSource" Click="btnDeleteProgramSource_OnClick" Width="100" Margin="10" Content="{DynamicResource wox_plugin_porgram_delete}"/>
<Button x:Name="btnEditProgramSource" Click="btnEditProgramSource_OnClick" Width="100" Margin="10" Content="Edit"/>
<Button x:Name="btnAddProgramSource" Click="btnAddProgramSource_OnClick" Width="100" Margin="10" Content="Add"/>
<Button x:Name="btnDeleteProgramSource" Click="btnDeleteProgramSource_OnClick" Width="100" Margin="10" Content="{DynamicResource wox_plugin_program_delete}"/>
<Button x:Name="btnEditProgramSource" Click="btnEditProgramSource_OnClick" Width="100" Margin="10" Content="{DynamicResource wox_plugin_program_edit}"/>
<Button x:Name="btnAddProgramSource" Click="btnAddProgramSource_OnClick" Width="100" Margin="10" Content="{DynamicResource wox_plugin_program_add}"/>
</StackPanel>
</DockPanel>
</Grid>

View File

@ -10,8 +10,11 @@ namespace Wox.Plugin.Program
/// </summary>
public partial class ProgramSetting : UserControl
{
public ProgramSetting()
private PluginInitContext context;
public ProgramSetting(PluginInitContext context)
{
this.context = context;
InitializeComponent();
Loaded += Setting_Loaded;
}
@ -55,8 +58,9 @@ namespace Wox.Plugin.Program
ProgramSource selectedProgramSource = programSourceView.SelectedItem as ProgramSource;
if (selectedProgramSource != null)
{
if (MessageBox.Show("Are your sure to delete " + selectedProgramSource.Location, "Delete ProgramSource",
MessageBoxButton.YesNo) == MessageBoxResult.Yes)
string msg = string.Format(context.API.GetTranslation("wox_plugin_program_delete_program_source"), selectedProgramSource.Location);
if (MessageBox.Show(msg, string.Empty, MessageBoxButton.YesNo) == MessageBoxResult.Yes)
{
ProgramStorage.Instance.ProgramSources.Remove(selectedProgramSource);
ProgramStorage.Instance.Save();
@ -65,7 +69,8 @@ namespace Wox.Plugin.Program
}
else
{
MessageBox.Show("Please select a program source");
string msg = context.API.GetTranslation("wox_plugin_program_pls_select_program_source");
MessageBox.Show(msg);
}
}
@ -86,7 +91,8 @@ namespace Wox.Plugin.Program
}
else
{
MessageBox.Show("Please select a program source");
string msg = context.API.GetTranslation("wox_plugin_program_pls_select_program_source");
MessageBox.Show(msg);
}
}
@ -97,8 +103,7 @@ namespace Wox.Plugin.Program
private void BtnProgramSuffixes_OnClick(object sender, RoutedEventArgs e)
{
ProgramSuffixes p = new ProgramSuffixes();
ProgramSuffixes p = new ProgramSuffixes(context);
p.ShowDialog();
}
}

View File

@ -5,13 +5,13 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
Width="400"
Height="170"
Height="180"
WindowStartupLocation="CenterScreen"
d:DesignHeight="400" d:DesignWidth="300">
<StackPanel>
<TextBlock Margin="10 10 0 0" Foreground="Gray">Wox will only index files that end with following suffixes.</TextBlock>
<TextBlock Margin="10 0 0 0" Foreground="Gray">Each suffix should split by ;</TextBlock>
<TextBlock Margin="10 10 0 0" Foreground="Gray" Text="{DynamicResource wox_plugin_program_only_index_tip}"></TextBlock>
<TextBlock Margin="10 10 0 0" Foreground="Gray" Text="{DynamicResource wox_plugin_program_split_by_tip}"></TextBlock>
<TextBox x:Name="tbSuffixes" Margin="10"/>
<Button HorizontalAlignment="Right" Height="30" Width="80" Click="ButtonBase_OnClick" Margin="10">Update</Button>
<Button HorizontalAlignment="Right" Height="30" Width="80" Click="ButtonBase_OnClick" Margin="10" Content="{DynamicResource wox_plugin_program_update}"></Button>
</StackPanel>
</Window>

View File

@ -7,8 +7,11 @@ namespace Wox.Plugin.Program
/// </summary>
public partial class ProgramSuffixes
{
public ProgramSuffixes()
private PluginInitContext context;
public ProgramSuffixes(PluginInitContext context)
{
this.context = context;
InitializeComponent();
tbSuffixes.Text = ProgramStorage.Instance.ProgramSuffixes;
@ -18,12 +21,14 @@ namespace Wox.Plugin.Program
{
if (string.IsNullOrEmpty(tbSuffixes.Text))
{
MessageBox.Show("File suffixes can't be empty");
string warning = context.API.GetTranslation("wox_plugin_program_suffixes_cannot_empty");
MessageBox.Show(warning);
return;
}
ProgramStorage.Instance.ProgramSuffixes = tbSuffixes.Text;
MessageBox.Show("Sucessfully update file suffixes");
string msg = context.API.GetTranslation("wox_plugin_program_update_file_suffixes");
MessageBox.Show(msg);
}
}
}

View File

@ -178,7 +178,7 @@ namespace Wox.Plugin.Program
public System.Windows.Controls.Control CreateSettingPanel()
{
return new ProgramSetting();
return new ProgramSetting(context);
}
#endregion

View File

@ -1,126 +1,131 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{FDB3555B-58EF-4AE6-B5F1-904719637AB4}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Wox.Plugin.Program</RootNamespace>
<AssemblyName>Wox.Plugin.Program</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\Output\Debug\Plugins\Wox.Plugin.Program\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net">
<HintPath>..\..\packages\log4net.2.0.3\lib\net35-full\log4net.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\Newtonsoft.Json.6.0.7\lib\net35\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="FileChangeWatcher.cs" />
<Compile Include="IProgramSource.cs" />
<Compile Include="Program.cs" />
<Compile Include="ProgramCacheStorage.cs" />
<Compile Include="Programs.cs" />
<Compile Include="ProgramSetting.xaml.cs">
<DependentUpon>ProgramSetting.xaml</DependentUpon>
</Compile>
<Compile Include="ProgramSource.cs" />
<Compile Include="ProgramSources\AppPathsProgramSource.cs" />
<Compile Include="ProgramSources\CommonStartMenuProgramSource.cs" />
<Compile Include="ProgramSources\FileSystemProgramSource.cs" />
<Compile Include="ProgramSources\UserStartMenuProgramSource.cs" />
<Compile Include="ProgramStorage.cs" />
<Compile Include="ProgramSuffixes.xaml.cs">
<DependentUpon>ProgramSuffixes.xaml</DependentUpon>
</Compile>
<Compile Include="StringEmptyConverter.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="plugin.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Include="Images\program.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<Content Include="Languages\en.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<Page Include="ProgramSetting.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="ProgramSuffixes.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Wox.Infrastructure\Wox.Infrastructure.csproj">
<Project>{4fd29318-a8ab-4d8f-aa47-60bc241b8da3}</Project>
<Name>Wox.Infrastructure</Name>
</ProjectReference>
<ProjectReference Include="..\..\Wox.Plugin\Wox.Plugin.csproj">
<Project>{8451ecdd-2ea4-4966-bb0a-7bbc40138e80}</Project>
<Name>Wox.Plugin</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。启用“NuGet 程序包还原”可下载这些程序包。有关详细信息,请参阅 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>
<!-- 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.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{FDB3555B-58EF-4AE6-B5F1-904719637AB4}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Wox.Plugin.Program</RootNamespace>
<AssemblyName>Wox.Plugin.Program</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\Output\Debug\Plugins\Wox.Plugin.Program\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net">
<HintPath>..\..\packages\log4net.2.0.3\lib\net35-full\log4net.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\Newtonsoft.Json.6.0.7\lib\net35\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="FileChangeWatcher.cs" />
<Compile Include="IProgramSource.cs" />
<Compile Include="Program.cs" />
<Compile Include="ProgramCacheStorage.cs" />
<Compile Include="Programs.cs" />
<Compile Include="ProgramSetting.xaml.cs">
<DependentUpon>ProgramSetting.xaml</DependentUpon>
</Compile>
<Compile Include="ProgramSource.cs" />
<Compile Include="ProgramSources\AppPathsProgramSource.cs" />
<Compile Include="ProgramSources\CommonStartMenuProgramSource.cs" />
<Compile Include="ProgramSources\FileSystemProgramSource.cs" />
<Compile Include="ProgramSources\UserStartMenuProgramSource.cs" />
<Compile Include="ProgramStorage.cs" />
<Compile Include="ProgramSuffixes.xaml.cs">
<DependentUpon>ProgramSuffixes.xaml</DependentUpon>
</Compile>
<Compile Include="StringEmptyConverter.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="plugin.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Include="Images\program.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<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>
<Page Include="ProgramSetting.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="ProgramSuffixes.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Wox.Infrastructure\Wox.Infrastructure.csproj">
<Project>{4fd29318-a8ab-4d8f-aa47-60bc241b8da3}</Project>
<Name>Wox.Infrastructure</Name>
</ProjectReference>
<ProjectReference Include="..\..\Wox.Plugin\Wox.Plugin.csproj">
<Project>{8451ecdd-2ea4-4966-bb0a-7bbc40138e80}</Project>
<Name>Wox.Plugin</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。启用“NuGet 程序包还原”可下载这些程序包。有关详细信息,请参阅 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>
<!-- 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.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@ -12,8 +12,8 @@ namespace Wox.Core.UI
public static void ApplyResources()
{
Application.Current.Resources.MergedDictionaries.Clear();
ApplyUIResources();
ApplyPluginLanguages();
ApplyUIResources();
}
private static void ApplyUIResources()
@ -37,13 +37,17 @@ namespace Wox.Core.UI
.SelectMany(s => s.GetTypes())
.Where(p => p.IsClass && !p.IsAbstract && pluginI18nType.IsAssignableFrom(p));
foreach (IPluginI18n pluginI18n in pluginI18ns)
foreach (var pluginI18n in pluginI18ns)
{
string languageFile = InternationalizationManager.Internationalization.GetLanguageFile(pluginI18n.GetLanguagesFolder());
Application.Current.Resources.MergedDictionaries.Add(new ResourceDictionary
string languageFile = InternationalizationManager.Internationalization.GetLanguageFile(
((IPluginI18n)Activator.CreateInstance(pluginI18n)).GetLanguagesFolder());
if (!string.IsNullOrEmpty(languageFile))
{
Source = new Uri(languageFile, UriKind.Absolute)
});
Application.Current.Resources.MergedDictionaries.Add(new ResourceDictionary
{
Source = new Uri(languageFile, UriKind.Absolute)
});
}
}
}
}

View File

@ -14,7 +14,7 @@ namespace Wox.Core.i18n
/// <summary>
/// Get language file for current user selected language
/// if couldn't find the current selected language file, it will first try to load en.xaml
/// if en.xaml couldn't find, it will pick up first *.xaml file
/// if en.xaml couldn't find, return empty string
/// </summary>
/// <param name="folder"></param>
/// <returns></returns>

View File

@ -137,16 +137,8 @@ namespace Wox.Core.i18n
{
return english;
}
else
{
string file = Directory.GetFiles(folder).FirstOrDefault(o => o.EndsWith("xaml"));
if (string.IsNullOrEmpty(file))
{
throw new WoxI18nException(string.Format("Couldn't find language file from:{0}, current selected language:{1}"));
}
return Path.Combine(folder, file);
}
return string.Empty;
}
}

View File

@ -36,6 +36,8 @@ namespace Wox.Plugin
void ReloadPlugins();
string GetTranslation(string key);
List<PluginPair> GetAllPlugins();
event WoxKeyDownEventHandler BackKeyDownEvent;

View File

@ -132,6 +132,11 @@ namespace Wox
Dispatcher.Invoke(new Action(() => PluginManager.Init(this)));
}
public string GetTranslation(string key)
{
return InternationalizationManager.Internationalization.GetTranslation(key);
}
public List<PluginPair> GetAllPlugins()
{
return PluginManager.AllPlugins;

View File

@ -482,7 +482,7 @@ namespace Wox
pluginTitle.Text = pair.Metadata.Name;
pluginTitle.Cursor = Cursors.Hand;
pluginActionKeyword.Text = pair.Metadata.ActionKeyword;
pluginAuthor.Text = "By: " + pair.Metadata.Author;
pluginAuthor.Text = InternationalizationManager.Internationalization.GetTranslation("author") + ": " + pair.Metadata.Author;
pluginSubTitle.Text = pair.Metadata.Description;
pluginId = pair.Metadata.ID;
pluginIcon.Source = ImageLoader.ImageLoader.Load(pair.Metadata.FullIcoPath);
@ -509,8 +509,6 @@ namespace Wox
control.Width = Double.NaN;
control.Height = Double.NaN;
}
// featureControls
// throw new NotImplementedException();
}
private void CbDisablePlugin_OnClick(object sender, RoutedEventArgs e)