Commit 542bbf90 LN

中英文完善

1 个父辈 6a03dce4
......@@ -14,7 +14,7 @@ namespace OnlineStore
{
public class crc : CodeResourceControl
{
}
public class CodeResourceControl
{
......@@ -23,7 +23,7 @@ namespace OnlineStore
public static string China = "zh-CN";
public static string Japan = "ja-JP";
public static string English = "en-US";
private static Dictionary<string,Dictionary<string, string>> LangMap = new Dictionary<string, Dictionary<string, string>>();
private static Dictionary<string, Dictionary<string, string>> LangMap = new Dictionary<string, Dictionary<string, string>>();
public delegate string GetLanguageDelegate();
public static event GetLanguageDelegate GetLanguageEvent;
......@@ -34,7 +34,8 @@ namespace OnlineStore
public static event EventHandler LanguageChangeEvent;
static CodeResourceControl() {
static CodeResourceControl()
{
LoadData();
......@@ -44,7 +45,7 @@ namespace OnlineStore
return;
try
{
Task.Delay(10 * 1000).Wait();
Task.Delay(10 * 1000).Wait();
if (SMF.UploadLangJsonData(lngjson, out SmfResult smfResult))
{
LogUtil.info("语言资源上传成功");
......@@ -98,13 +99,17 @@ namespace OnlineStore
foreach (string line in lines)
{
if (string.IsNullOrEmpty(line))
continue;
string[] array = line.Split(spilt);
if (array.Length >= 3)
continue;
string[] array = line.Replace(spilt + "" + spilt, spilt+"").Split(spilt);
if (array.Length >= 2)
{
string key = array[0].Trim();
string value = array[2];
string value = array[1];
if (array.Length >= 3)
{
value = array[2];
}
if (lngMap.ContainsKey(key))
lngMap[key] = value;
else
......@@ -139,7 +144,8 @@ namespace OnlineStore
public static void LanguageChange() {
public static void LanguageChange()
{
LanguageChangeEvent?.Invoke(null, EventArgs.Empty);
}
public static string GetLanguage()
......@@ -170,7 +176,8 @@ namespace OnlineStore
{
string strCurLanguage = defaultStr;
var haslang = getLangRes(CurrLanguage);
if (!haslang) {
if (!haslang)
{
return strCurLanguage;
}
try
......@@ -217,24 +224,27 @@ namespace OnlineStore
hss.Add(id);
LOG.Info("" + id + "\t" + defaultStr);
}
}
}
private static bool checkInterid(string id) {
private static bool checkInterid(string id)
{
return true;
string[] interstring = new string[] { "_txt", "_lbl" };
var x = from a in interstring
where id.IndexOf(a) > -1
select a;
return x.Count() == 0;
}
}
private static bool getLangRes(string lang) {
if (!LangMap.ContainsKey(lang)) {
string path = Application.StartupPath + @"\resources\"+lang+ ".lngres";
private static bool getLangRes(string lang)
{
if (!LangMap.ContainsKey(lang))
{
string path = Application.StartupPath + @"\resources\" + lang + ".lngres";
if (!File.Exists(path))
{
return false;
......@@ -254,7 +264,7 @@ namespace OnlineStore
map.Remove(key);
}
map.Add(key, english);
}
}
LangMap.Add(lang, map);
......@@ -265,7 +275,7 @@ namespace OnlineStore
}
public static string CurrLanguage = "";
public static void LanguageProcess(ContainerControl cc, string className="")
public static void LanguageProcess(ContainerControl cc, string className = "")
{
if (string.IsNullOrEmpty(className))
className = cc.GetType().Name;
......@@ -286,6 +296,8 @@ namespace OnlineStore
private static void PreControlLanaguage(Control partentControl, string className)
{
string newStr = "";
//Con_GetTxt(partentControl, out string title);
//string newStr = GetString(GetTextIdStr(className, partentControl.Name), title);
//if (!newStr.Equals(""))
......@@ -302,32 +314,46 @@ namespace OnlineStore
continue;
}
if (Con_GetTxt(con, out txt))
{
newStr = GetString(GetTextIdStr(className, con.Name), txt);
if (!newStr.Equals(""))
{
Con_SetTxt(con, newStr.Replace("\\n", "\n"));
//haslang = true;
}
}
if (con.Tag !=null && con.Tag.ToString() == "nochiled")
if (con.Tag != null && con.Tag.ToString() == "nochiled")
{
continue;
}
if (con.Controls.Count > 0 && !haslang)
{
PreControlLanaguage(con, className+"_"+ con.Name);
//kmon
PreControlLanaguage(con, className + "_" + con.Name);
}
//Console.WriteLine(con is IList<Component>);
//Console.WriteLine(con is IList<Component>);
}
}
public static void ProcessListItem<T>(T con,string ClassName) where T: ToolStripItemCollection
public static void ProcessListItem<T>(T con, string ClassName) where T : ToolStripItemCollection
{
for (int i = 0; i < con.Count; i++) {
for (int i = 0; i < con.Count; i++)
{
if (con[i].Tag != null && con[i].Tag.ToString() == "not")
{
continue;
......@@ -337,10 +363,11 @@ namespace OnlineStore
string newStr = GetString(GetTextIdStr(ClassName, con[i].Name), txt);
if (!newStr.Equals(""))
{
con[i].Text= newStr.Replace("\\n", "\n");
con[i].Text = newStr.Replace("\\n", "\n");
//haslang = true;
}
if (con[i] is ToolStripMenuItem) {
if (con[i] is ToolStripMenuItem)
{
var tt = ((ToolStripMenuItem)con[i]);
ProcessListItem(tt.DropDownItems, tt.Name);
}
......@@ -380,9 +407,10 @@ namespace OnlineStore
if (p == null)
return;
else
p.SetValue(con, txt,null);
p.SetValue(con, txt, null);
}
static string getMethodname(Control con) {
static string getMethodname(Control con)
{
string methodname = "Text";
//if (con is UCBtnExt) methodname = "BtnText";
......
......@@ -846,7 +846,7 @@ namespace TheMachine
if (RobotManage.isRunning)
{
RobotManage_UserPauseSet(null, RobotManage.IsUserPause);
}
}
}
private void 简体中文ToolStripMenuItem_Click(object sender, EventArgs e)
......
......@@ -48,6 +48,8 @@ namespace TheMachine
//
// btn_linerun
//
this.btn_linerun.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btn_linerun.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn_linerun.Location = new System.Drawing.Point(566, 368);
this.btn_linerun.Name = "btn_linerun";
this.btn_linerun.Size = new System.Drawing.Size(113, 32);
......@@ -58,6 +60,8 @@ namespace TheMachine
//
// btn_linerev
//
this.btn_linerev.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btn_linerev.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn_linerev.Location = new System.Drawing.Point(685, 368);
this.btn_linerev.Name = "btn_linerev";
this.btn_linerev.Size = new System.Drawing.Size(105, 32);
......@@ -68,6 +72,8 @@ namespace TheMachine
//
// btn_linestop
//
this.btn_linestop.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btn_linestop.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn_linestop.Location = new System.Drawing.Point(566, 406);
this.btn_linestop.Name = "btn_linestop";
this.btn_linestop.Size = new System.Drawing.Size(224, 32);
......@@ -160,6 +166,8 @@ namespace TheMachine
//
// btn_flipopen
//
this.btn_flipopen.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btn_flipopen.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn_flipopen.Location = new System.Drawing.Point(566, 444);
this.btn_flipopen.Name = "btn_flipopen";
this.btn_flipopen.Size = new System.Drawing.Size(113, 32);
......@@ -170,6 +178,8 @@ namespace TheMachine
//
// btn_flipclose
//
this.btn_flipclose.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btn_flipclose.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn_flipclose.Location = new System.Drawing.Point(685, 444);
this.btn_flipclose.Name = "btn_flipclose";
this.btn_flipclose.Size = new System.Drawing.Size(105, 32);
......@@ -180,6 +190,8 @@ namespace TheMachine
//
// btn_stringdooropen
//
this.btn_stringdooropen.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btn_stringdooropen.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn_stringdooropen.Location = new System.Drawing.Point(566, 482);
this.btn_stringdooropen.Name = "btn_stringdooropen";
this.btn_stringdooropen.Size = new System.Drawing.Size(113, 32);
......@@ -190,6 +202,8 @@ namespace TheMachine
//
// btn_stringdoorclose
//
this.btn_stringdoorclose.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btn_stringdoorclose.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn_stringdoorclose.Location = new System.Drawing.Point(685, 482);
this.btn_stringdoorclose.Name = "btn_stringdoorclose";
this.btn_stringdoorclose.Size = new System.Drawing.Size(105, 32);
......@@ -200,6 +214,8 @@ namespace TheMachine
//
// btn_ngdooropen
//
this.btn_ngdooropen.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btn_ngdooropen.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn_ngdooropen.Location = new System.Drawing.Point(566, 331);
this.btn_ngdooropen.Name = "btn_ngdooropen";
this.btn_ngdooropen.Size = new System.Drawing.Size(113, 32);
......@@ -210,6 +226,8 @@ namespace TheMachine
//
// btn_ngdoorclose
//
this.btn_ngdoorclose.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btn_ngdoorclose.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn_ngdoorclose.Location = new System.Drawing.Point(685, 331);
this.btn_ngdoorclose.Name = "btn_ngdoorclose";
this.btn_ngdoorclose.Size = new System.Drawing.Size(105, 32);
......
......@@ -127,7 +127,7 @@ namespace TheMachine
Task.Run(() => CodeManager.TestHasReel(CodeManager.hikNameList[0], out _, out _));
}
//private void button2_Click(object sender, EventArgs e)
//{
// DeviceLibrary.IPCameraHelper.StartRecord("manual");
......
......@@ -7,7 +7,7 @@
<ProjectGuid>{61FDFF14-8BB7-439A-85A0-592E3011F4C4}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>TheMachine</RootNamespace>
<AssemblyName>MIMO_G2_Client</AssemblyName>
<AssemblyName>MIMO_G2</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
......
......@@ -47,5 +47,12 @@ namespace TheMachine
else
MessageBox.Show(crc.GetString("Res0057","密码不正确请重新输入!"));
}
private void FrmPassCheck_Load(object sender, EventArgs e)
{
crc.LanguageProcess(this);
this.Text = crc.GetString("PEnterPwd", "请输入密码");
}
}
}
\ No newline at end of file
......@@ -78,6 +78,7 @@ namespace TheMachine
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.Text = "请输入密码";
this.Load += new System.EventHandler(this.FrmPassCheck_Load);
this.ResumeLayout(false);
this.PerformLayout();
......
......@@ -24,10 +24,20 @@ namespace TheMachine
crc.LanguageChangeEvent += Crc_LanguageChangeEvent;
// crc.LanguageProcess(this);
}
private void Crc_LanguageChangeEvent(object sender, EventArgs e)
public void Crc_LanguageChangeEvent(object sender, EventArgs e)
{
if (Config == null)
return;
{
if (RobotManage.Config != null)
{
this.Config=RobotManage.Config;
}
else
{
return;
}
}
crc.LanguageProcess(this);
LoadLedList();
......
此文件类型无法预览
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!