Add translation for folder plugin

This commit is contained in:
qianlifeng 2015-01-07 18:59:55 +08:00
parent 12abca39a2
commit d3bf71a22d
11 changed files with 346 additions and 244 deletions

View File

@ -77,6 +77,11 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="Languages\zh-tw.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\Wox.Infrastructure\Wox.Infrastructure.csproj"> <ProjectReference Include="..\..\Wox.Infrastructure\Wox.Infrastructure.csproj">

View File

@ -3,19 +3,20 @@ using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Reflection;
using System.Windows; using System.Windows;
using Control = System.Windows.Controls.Control; using Control = System.Windows.Controls.Control;
namespace Wox.Plugin.Folder namespace Wox.Plugin.Folder
{ {
public class FolderPlugin : IPlugin, ISettingProvider public class FolderPlugin : IPlugin, ISettingProvider,IPluginI18n
{ {
private static List<string> driverNames; private static List<string> driverNames;
private PluginInitContext context; private PluginInitContext context;
public Control CreateSettingPanel() public Control CreateSettingPanel()
{ {
return new FileSystemSettings(); return new FileSystemSettings(context);
} }
public void Init(PluginInitContext context) public void Init(PluginInitContext context)
@ -183,5 +184,10 @@ namespace Wox.Plugin.Folder
return results; return results;
} }
public string GetLanguagesFolder()
{
return Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Languages");
}
} }
} }

View File

@ -4,7 +4,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300"> d:DesignHeight="300" d:DesignWidth="500">
<Grid Margin="10"> <Grid Margin="10">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
@ -13,7 +13,7 @@
<ListView x:Name="lbxFolders" Grid.Row="0"> <ListView x:Name="lbxFolders" Grid.Row="0">
<ListView.View> <ListView.View>
<GridView> <GridView>
<GridViewColumn Header="Folder Path" Width="180"> <GridViewColumn Header="{DynamicResource wox_plugin_folder_folder_path}" Width="180">
<GridViewColumn.CellTemplate> <GridViewColumn.CellTemplate>
<DataTemplate> <DataTemplate>
<TextBlock Text="{Binding Path}"/> <TextBlock Text="{Binding Path}"/>
@ -24,9 +24,9 @@
</ListView.View> </ListView.View>
</ListView> </ListView>
<StackPanel Grid.Row="1" HorizontalAlignment="Right" Orientation="Horizontal"> <StackPanel Grid.Row="1" HorizontalAlignment="Right" Orientation="Horizontal">
<Button x:Name="btnDelete" Click="btnDelete_Click" Width="100" Margin="10" Content="Delete"/> <Button x:Name="btnDelete" Click="btnDelete_Click" Width="100" Margin="10" Content="{DynamicResource wox_plugin_folder_delete}"/>
<Button x:Name="btnEdit" Click="btnEdit_Click" Width="100" Margin="10" Content="Edit"/> <Button x:Name="btnEdit" Click="btnEdit_Click" Width="100" Margin="10" Content="{DynamicResource wox_plugin_folder_edit}"/>
<Button x:Name="btnAdd" Click="btnAdd_Click" Width="100" Margin="10" Content="Add"/> <Button x:Name="btnAdd" Click="btnAdd_Click" Width="100" Margin="10" Content="{DynamicResource wox_plugin_folder_add}"/>
</StackPanel> </StackPanel>
</Grid> </Grid>
</UserControl> </UserControl>

View File

@ -13,8 +13,11 @@ namespace Wox.Plugin.Folder
/// </summary> /// </summary>
public partial class FileSystemSettings : UserControl public partial class FileSystemSettings : UserControl
{ {
public FileSystemSettings() PluginInitContext context;
public FileSystemSettings(PluginInitContext context)
{ {
this.context = context;
InitializeComponent(); InitializeComponent();
lbxFolders.ItemsSource = FolderStorage.Instance.FolderLinks; lbxFolders.ItemsSource = FolderStorage.Instance.FolderLinks;
} }
@ -29,7 +32,8 @@ namespace Wox.Plugin.Folder
} }
else else
{ {
MessageBox.Show("Please select a folder link!"); string warning = context.API.GetTranslation("wox_plugin_folder_select_folder_link_warning");
MessageBox.Show(warning);
} }
} }
@ -52,7 +56,8 @@ namespace Wox.Plugin.Folder
} }
else else
{ {
MessageBox.Show("Please select a folder link!"); string warning = context.API.GetTranslation("wox_plugin_folder_select_folder_link_warning");
MessageBox.Show(warning);
} }
} }

View 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_folder_delete">Delete</system:String>
<system:String x:Key="wox_plugin_folder_edit">Edit</system:String>
<system:String x:Key="wox_plugin_folder_add">Add</system:String>
<system:String x:Key="wox_plugin_folder_folder_path">Folder Path</system:String>
<system:String x:Key="wox_plugin_folder_select_folder_link_warning">Please select a folder link</system:String>
</ResourceDictionary>

View 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_folder_delete">删除</system:String>
<system:String x:Key="wox_plugin_folder_edit">编辑</system:String>
<system:String x:Key="wox_plugin_folder_add">添加</system:String>
<system:String x:Key="wox_plugin_folder_folder_path">文件夹路径</system:String>
<system:String x:Key="wox_plugin_folder_select_folder_link_warning">请选择一个文件夹</system:String>
</ResourceDictionary>

View 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_folder_delete">刪除</system:String>
<system:String x:Key="wox_plugin_folder_edit">編輯</system:String>
<system:String x:Key="wox_plugin_folder_add">添加</system:String>
<system:String x:Key="wox_plugin_folder_folder_path">文件夾路徑</system:String>
<system:String x:Key="wox_plugin_folder_select_folder_link_warning">請選擇一個文件夾</system:String>
</ResourceDictionary>

View File

@ -71,6 +71,21 @@
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</Page> </Page>
<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>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\Wox.Infrastructure\Wox.Infrastructure.csproj"> <ProjectReference Include="..\..\Wox.Infrastructure\Wox.Infrastructure.csproj">

View File

@ -93,6 +93,11 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="Languages\zh-tw.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<Page Include="ProgramSetting.xaml"> <Page Include="ProgramSetting.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>

View File

@ -0,0 +1,28 @@
<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_websearch_delete">刪除</system:String>
<system:String x:Key="wox_plugin_websearch_edit">編輯</system:String>
<system:String x:Key="wox_plugin_websearch_add">添加</system:String>
<system:String x:Key="wox_plugin_websearch_action_keyword">觸發關鍵字</system:String>
<system:String x:Key="wox_plugin_websearch_url">URL</system:String>
<system:String x:Key="wox_plugin_websearch_enable_suggestion">啟用搜索建議</system:String>
<system:String x:Key="wox_plugin_websearch_pls_select_web_search">請選擇一項</system:String>
<system:String x:Key="wox_plugin_websearch_delete_warning">你確定要刪除 {0} 嗎?</system:String>
<!--web search edit-->
<system:String x:Key="wox_plugin_websearch_title">標題</system:String>
<system:String x:Key="wox_plugin_websearch_enable">啟用</system:String>
<system:String x:Key="wox_plugin_websearch_icon">圖標</system:String>
<system:String x:Key="wox_plugin_websearch_select_icon">選擇圖標</system:String>
<system:String x:Key="wox_plugin_websearch_cancel">取消</system:String>
<system:String x:Key="wox_plugin_websearch_invalid_web_search">非法的網頁搜索</system:String>
<system:String x:Key="wox_plugin_websearch_input_title">請輸入標題</system:String>
<system:String x:Key="wox_plugin_websearch_input_action_keyword">請輸入觸發關鍵字</system:String>
<system:String x:Key="wox_plugin_websearch_input_url">請輸入URL</system:String>
<system:String x:Key="wox_plugin_websearch_action_keyword_exist">觸發關鍵字已經存在,請選擇一個新的關鍵字</system:String>
<system:String x:Key="wox_plugin_websearch_succeed">操作成功</system:String>
</ResourceDictionary>

View File

@ -74,6 +74,11 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="Languages\zh-tw.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<Page Include="WebSearchesSetting.xaml"> <Page Include="WebSearchesSetting.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>