Browse Source

i18n use external file

tags/4.1.9.2-nbbnu
Student Main 5 years ago
parent
commit
e652eb753c
4 changed files with 2 additions and 47 deletions
  1. +1
    -12
      shadowsocks-csharp/Controller/I18N.cs
  2. +0
    -26
      shadowsocks-csharp/Properties/Resources.Designer.cs
  3. +0
    -3
      shadowsocks-csharp/Properties/Resources.resx
  4. +1
    -6
      shadowsocks-csharp/View/MenuViewController.cs

+ 1
- 12
shadowsocks-csharp/Controller/I18N.cs View File

@@ -9,7 +9,6 @@ using System.Windows.Forms;
namespace Shadowsocks.Controller
{
public static class I18N
{
public const string I18N_FILE = "i18n.csv";
@@ -76,18 +75,8 @@ namespace Shadowsocks.Controller
static I18N()
{
string i18n;
string locale = CultureInfo.CurrentCulture.Name;
if (!File.Exists(I18N_FILE))
{
i18n = Resources.i18n_csv;
//File.WriteAllText(I18N_FILE, i18n, Encoding.UTF8);
}
else
{
Logging.Info("Using external translation");
i18n = File.ReadAllText(I18N_FILE, Encoding.UTF8);
}
string i18n = File.ReadAllText(Utils.GetDataPath(I18N_FILE), Encoding.UTF8);
Logging.Info("Current language is: " + locale);
Init(i18n, locale);
}


+ 0
- 26
shadowsocks-csharp/Properties/Resources.Designer.cs View File

@@ -114,32 +114,6 @@ namespace Shadowsocks.Properties {
}
}
/// <summary>
/// 查找类似 en,zh-CN,zh-TW,ja
///#Restart program to apply translation,,,
///#This is comment line,,,
///#Always keep language name at head of file,,,
///#Language name is output in log,,,
///&quot;#You can find it by search &quot;&quot;Current language is:&quot;&quot;&quot;,,,
///#Please use UTF-8 with BOM encoding so we can edit it in Excel,,,
///,,,
///Shadowsocks,Shadowsocks,Shadowsocks,Shadowsocks
///,,,
///#Menu,,,
///,,,
///System Proxy,系统代理,系統代理,システムプロキシ
///Disable,禁用,禁用,無効
///PAC,PAC 模式,PAC 模式,PAC
///Global,全局模式,全局模式,全般
///Servers,服务器,伺服器,サーバー
///Edit Servers...,编辑服务器...,編 [字符串的其余部分被截断]&quot;; 的本地化字符串。
/// </summary>
internal static string i18n_csv {
get {
return ResourceManager.GetString("i18n_csv", resourceCulture);
}
}
/// <summary>
/// 查找 System.Byte[] 类型的本地化资源。
/// </summary>


+ 0
- 3
shadowsocks-csharp/Properties/Resources.resx View File

@@ -124,9 +124,6 @@
<data name="default_abp_rule" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Data\default-abp-rule.js;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
<data name="i18n_csv" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Data\i18n.csv;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
<data name="libsscrypto" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Data\libsscrypto.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>


+ 1
- 6
shadowsocks-csharp/View/MenuViewController.cs View File

@@ -320,7 +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)),
//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("-"),
@@ -717,11 +717,6 @@ 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