using System.Collections; using System.Collections.Generic; namespace Netch.Utils { public static class i18N { /// /// 数据 /// public static Hashtable Data = new Hashtable(); /// /// 加载 /// /// 语言文件 public static void Load(string text) { var data = Newtonsoft.Json.JsonConvert.DeserializeObject>(text); if (data != null) { Data = new Hashtable(); foreach (var v in data) { Data.Add(v.Key, v.Value); } } } /// /// 翻译 /// /// 需要翻译的文本 /// 翻译完毕的文本 public static string Translate(string text) { if (Data.Contains(text)) { return Data[text].ToString(); } return text; } } }