Commit 542bbf90 LN

中英文完善

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