Browse Source

Write i18n.csv on demand

tags/4.1.9.2
Student Main 5 years ago
parent
commit
6a3dfeff60
3 changed files with 19 additions and 13 deletions
  1. +3
    -2
      shadowsocks-csharp/Controller/I18N.cs
  2. +1
    -0
      shadowsocks-csharp/Data/i18n.csv
  3. +15
    -11
      shadowsocks-csharp/View/MenuViewController.cs

+ 3
- 2
shadowsocks-csharp/Controller/I18N.cs View File

@@ -12,7 +12,7 @@ namespace Shadowsocks.Controller
public static class I18N
{
private const string I18N_FILE = "i18n.csv";
public const string I18N_FILE = "i18n.csv";
private static Dictionary<string, string> _strings = new Dictionary<string, string>();
@@ -81,10 +81,11 @@ namespace Shadowsocks.Controller
if (!File.Exists(I18N_FILE))
{
i18n = Resources.i18n_csv;
File.WriteAllText(I18N_FILE, i18n, Encoding.UTF8);
//File.WriteAllText(I18N_FILE, i18n, Encoding.UTF8);
}
else
{
Logging.Info("Using external translation");
i18n = File.ReadAllText(I18N_FILE, Encoding.UTF8);
}
Logging.Info("Current language is: " + locale);


+ 1
- 0
shadowsocks-csharp/Data/i18n.csv View File

@@ -46,6 +46,7 @@ Load Balance,负载均衡,負載平衡,負荷分散
High Availability,高可用,高可用性,高可用性
Choose by statistics,根据统计,根據統計,統計で選ぶ
Show Plugin Output,显示插件输出,,
Write translation template,写入翻译模板,,
,,,
# Config Form,,,
,,,


+ 15
- 11
shadowsocks-csharp/View/MenuViewController.cs View File

@@ -1,21 +1,18 @@
using System;
using Shadowsocks.Controller;
using Shadowsocks.Model;
using Shadowsocks.Properties;
using Shadowsocks.Util;
using System;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ZXing;
using ZXing.Common;
using ZXing.QrCode;
using Shadowsocks.Controller;
using Shadowsocks.Model;
using Shadowsocks.Properties;
using Shadowsocks.Util;
using System.Linq;
using Microsoft.Win32;
using System.Windows.Interop;
namespace Shadowsocks.View
{
public class MenuViewController
@@ -56,6 +53,7 @@ namespace Shadowsocks.View
private MenuItem hotKeyItem;
private MenuItem VerboseLoggingToggleItem;
private MenuItem ShowPluginOutputToggleItem;
private MenuItem WriteI18NFileItem;
private ConfigForm configForm;
private ProxyForm proxyForm;
@@ -322,6 +320,7 @@ namespace Shadowsocks.View
CreateMenuItem("Show Logs...", new EventHandler(this.ShowLogItem_Click)),
this.VerboseLoggingToggleItem = CreateMenuItem( "Verbose Logging", new EventHandler(this.VerboseLoggingToggleItem_Click) ),
this.ShowPluginOutputToggleItem = CreateMenuItem("Show Plugin Output", new EventHandler(this.ShowPluginOutputToggleItem_Click)),
this.WriteI18NFileItem = CreateMenuItem("Write translation template",new EventHandler(WriteI18NFileItem_Click)),
CreateMenuGroup("Updates...", new MenuItem[] {
CreateMenuItem("Check for Updates...", new EventHandler(this.checkUpdatesItem_Click)),
new MenuItem("-"),
@@ -718,6 +717,11 @@ namespace Shadowsocks.View
controller.ToggleShowPluginOutput(ShowPluginOutputToggleItem.Checked);
}
private void WriteI18NFileItem_Click(object sender, EventArgs e)
{
File.WriteAllText(I18N.I18N_FILE, Resources.i18n_csv, Encoding.UTF8);
}
private void StatisticsConfigItem_Click(object sender, EventArgs e)
{
StatisticsStrategyConfigurationForm form = new StatisticsStrategyConfigurationForm(controller);


Loading…
Cancel
Save