Add translation for icon tray.

This commit is contained in:
qianlifeng 2015-02-21 21:57:00 +08:00
parent 5ace62a5fd
commit 7aae1b262e
9 changed files with 54 additions and 28 deletions

View File

@ -74,7 +74,7 @@ namespace Wox.Plugin
/// <summary>
/// Open setting dialog
/// </summary>
void OpenSettingDialog();
void OpenSettingDialog(string tabName = "general");
/// <summary>
/// Show loading animation

View File

@ -6,7 +6,7 @@ using System.Windows;
namespace Wox.Helper
{
public static class WindowOpener
public static class SingletonWindowOpener
{
public static T Open<T>(params object[] args) where T : Window
{

View File

@ -1,17 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace Wox.Helper
{
public class WoxLog4netPathConverter : log4net.Util.PatternConverter
{
protected override void Convert(TextWriter writer, object state)
{
string userProfilePath = Environment.GetEnvironmentVariable("USERPROFILE");
writer.Write(Path.Combine(userProfilePath, ".Wox"));
}
}
}

View File

@ -9,6 +9,10 @@
<system:String x:Key="cancelTopMostInThisQuery">Cancel topmost in this query</system:String>
<system:String x:Key="executeQuery">Execute query:{0}</system:String>
<system:String x:Key="lastExecuteTime">Last execute time:{0}</system:String>
<system:String x:Key="iconTrayOpen">Open</system:String>
<system:String x:Key="iconTraySettings">Settings</system:String>
<system:String x:Key="iconTrayAbout">About</system:String>
<system:String x:Key="iconTrayExit">Exit</system:String>
<!--Setting General-->
<system:String x:Key="woxsettings">Wox Settings</system:String>

View File

@ -9,6 +9,10 @@
<system:String x:Key="cancelTopMostInThisQuery">取消置顶</system:String>
<system:String x:Key="executeQuery">执行查询:{0}</system:String>
<system:String x:Key="lastExecuteTime">上次执行时间:{0}</system:String>
<system:String x:Key="iconTrayOpen">打开</system:String>
<system:String x:Key="iconTraySettings">设置</system:String>
<system:String x:Key="iconTrayAbout">关于</system:String>
<system:String x:Key="iconTrayExit">退出</system:String>
<!--设置,通用-->
<system:String x:Key="woxsettings">Wox设置</system:String>

View File

@ -9,6 +9,10 @@
<system:String x:Key="cancelTopMostInThisQuery">取消置頂</system:String>
<system:String x:Key="executeQuery">執行查詢:{0}</system:String>
<system:String x:Key="lastExecuteTime">上次執行時間:{0}</system:String>
<system:String x:Key="iconTrayOpen">打開</system:String>
<system:String x:Key="iconTraySettings">設置</system:String>
<system:String x:Key="iconTrayAbout">关于</system:String>
<system:String x:Key="iconTrayExit">退出</system:String>
<!--設置,通用-->
<system:String x:Key="woxsettings">Wox設置</system:String>

View File

@ -112,9 +112,13 @@ namespace Wox
}));
}
public void OpenSettingDialog()
public void OpenSettingDialog(string tabName = "general")
{
Dispatcher.Invoke(new Action(() => WindowOpener.Open<SettingWindow>(this)));
Dispatcher.Invoke(new Action(() =>
{
SettingWindow sw = SingletonWindowOpener.Open<SettingWindow>(this);
sw.SwitchTo(tabName);
}));
}
public void StartLoadingBar()
@ -190,7 +194,6 @@ namespace Wox
WebRequest.RegisterPrefix("data", new DataWebRequestFactory());
GlobalHotkey.Instance.hookedKeyboardCallback += KListener_hookedKeyboardCallback;
progressBar.ToolTip = toolTip;
InitialTray();
pnlResult.LeftMouseClickEvent += SelectResult;
pnlResult.ItemDropEvent += pnlResult_ItemDropEvent;
pnlContextMenu.LeftMouseClickEvent += SelectResult;
@ -201,6 +204,7 @@ namespace Wox
SetHotkey(UserSettingStorage.Instance.Hotkey, OnHotkey);
SetCustomPluginHotkey();
InitialTray();
Closing += MainWindow_Closing;
//since MainWIndow implement IPublicAPI, so we need to finish ctor MainWindow object before
@ -396,13 +400,15 @@ namespace Wox
{
notifyIcon = new NotifyIcon { Text = "Wox", Icon = Properties.Resources.app, Visible = true };
notifyIcon.Click += (o, e) => ShowWox();
var open = new MenuItem("Open");
var open = new MenuItem(GetTranslation("iconTrayOpen"));
open.Click += (o, e) => ShowWox();
var setting = new MenuItem("Settings");
var setting = new MenuItem(GetTranslation("iconTraySettings"));
setting.Click += (o, e) => OpenSettingDialog();
var exit = new MenuItem("Exit");
var about = new MenuItem(GetTranslation("iconTrayAbout"));
about.Click += (o, e) => OpenSettingDialog("about");
var exit = new MenuItem(GetTranslation("iconTrayExit"));
exit.Click += (o, e) => CloseApp();
MenuItem[] childen = { open, setting, exit };
MenuItem[] childen = { open, setting, about, exit };
notifyIcon.ContextMenu = new ContextMenu(childen);
}

View File

@ -127,6 +127,31 @@ namespace Wox
settingsLoaded = true;
}
public void SwitchTo(string tabName)
{
switch (tabName)
{
case "general":
settingTab.SelectedIndex = 0;
break;
case "plugin":
settingTab.SelectedIndex = 1;
break;
case "theme":
settingTab.SelectedIndex = 2;
break;
case "hotkey":
settingTab.SelectedIndex = 3;
break;
case "proxy":
settingTab.SelectedIndex = 4;
break;
case "about":
settingTab.SelectedIndex = 5;
break;
}
}
#region General
private void LoadLanguages()

View File

@ -122,6 +122,7 @@
<Compile Include="Converters\OpacityModeConverter.cs" />
<Compile Include="Converters\StringEmptyConverter.cs" />
<Compile Include="Converters\StringNullOrEmptyToVisibilityConverter.cs" />
<Compile Include="Helper\SingletonWindowOpener.cs" />
<Compile Include="ImageLoader\ImageCacheStroage.cs" />
<Compile Include="ShellContext\ShellContextMenuManager.cs" />
<Compile Include="ShellContext\ShellAPI.cs" />
@ -158,7 +159,6 @@
<Compile Include="Helper\SyntaxSugars.cs" />
<Compile Include="Helper\WallpaperPathRetrieval.cs" />
<Compile Include="Helper\WindowIntelopHelper.cs" />
<Compile Include="Helper\WindowOpener.cs" />
<Compile Include="CustomQueryHotkeySetting.xaml.cs">
<DependentUpon>CustomQueryHotkeySetting.xaml</DependentUpon>
</Compile>