Browse Source

多语言本地化优化及资源文件更新

本次提交将部分硬编码中文提示改为通过 Lang 资源文件获取,提升了系统的多语言支持能力。主要包括:Management.cs 错误提示本地化,PlcPointParamsViewModel.cs 导入点位弹窗内容和标题本地化,Lang.resx 新增相关字符串资源,Lang.Designer.cs 自动生成代码同步更新,并升级了资源生成工具版本。
徐孝锋 8 months ago
parent
commit
81f72fd3c8

+ 1 - 1
TeamAAS-VM/Core/Management.cs

@@ -369,7 +369,7 @@ namespace TeamAAS_VP.Core
             }
             }
             catch (Exception ex)
             catch (Exception ex)
             {
             {
-                LogHelper.WriteLogError("为PLC写入系统参数和订阅变量时出错", ex);
+                LogHelper.WriteLogError(Lang.为PLC写入系统参数和订阅变量时出错, ex);
             }
             }
             if (sb.Length == 0)
             if (sb.Length == 0)
             {
             {

+ 28 - 1
TeamAAS-VM/Resources/Languages/Lang.Designer.cs

@@ -19,7 +19,7 @@ namespace TeamAAS_VP.Resources.Languages {
     // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
     // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
     // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
     // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
     // (以 /str 作为命令选项),或重新生成 VS 项目。
     // (以 /str 作为命令选项),或重新生成 VS 项目。
-    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "18.0.0.0")]
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
     [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
     [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
     public class Lang {
     public class Lang {
@@ -1320,6 +1320,15 @@ namespace TeamAAS_VP.Resources.Languages {
             }
             }
         }
         }
         
         
+        /// <summary>
+        ///   查找类似 为PLC写入系统参数和订阅变量时出错 的本地化字符串。
+        /// </summary>
+        public static string 为PLC写入系统参数和订阅变量时出错 {
+            get {
+                return ResourceManager.GetString("为PLC写入系统参数和订阅变量时出错", resourceCulture);
+            }
+        }
+        
         /// <summary>
         /// <summary>
         ///   查找类似 二次定位相机测试 的本地化字符串。
         ///   查找类似 二次定位相机测试 的本地化字符串。
         /// </summary>
         /// </summary>
@@ -2787,6 +2796,15 @@ namespace TeamAAS_VP.Resources.Languages {
             }
             }
         }
         }
         
         
+        /// <summary>
+        ///   查找类似 导入点位 的本地化字符串。
+        /// </summary>
+        public static string 导入点位 {
+            get {
+                return ResourceManager.GetString("导入点位", resourceCulture);
+            }
+        }
+        
         /// <summary>
         /// <summary>
         ///   查找类似 导出当前页 的本地化字符串。
         ///   查找类似 导出当前页 的本地化字符串。
         /// </summary>
         /// </summary>
@@ -5370,6 +5388,15 @@ namespace TeamAAS_VP.Resources.Languages {
             }
             }
         }
         }
         
         
+        /// <summary>
+        ///   查找类似 确认要从点位编号 {0} 开始导入 {1} 个点位吗? 的本地化字符串。
+        /// </summary>
+        public static string 确认要从点位编号0开始导入1个点位吗 {
+            get {
+                return ResourceManager.GetString("确认要从点位编号0开始导入1个点位吗", resourceCulture);
+            }
+        }
+        
         /// <summary>
         /// <summary>
         ///   查找类似 示教 的本地化字符串。
         ///   查找类似 示教 的本地化字符串。
         /// </summary>
         /// </summary>

+ 9 - 0
TeamAAS-VM/Resources/Languages/Lang.resx

@@ -2612,4 +2612,13 @@
   <data name="设置吸嘴报警值" xml:space="preserve">
   <data name="设置吸嘴报警值" xml:space="preserve">
     <value>设置吸嘴报警值</value>
     <value>设置吸嘴报警值</value>
   </data>
   </data>
+  <data name="为PLC写入系统参数和订阅变量时出错" xml:space="preserve">
+    <value>为PLC写入系统参数和订阅变量时出错</value>
+  </data>
+  <data name="确认要从点位编号0开始导入1个点位吗" xml:space="preserve">
+    <value>确认要从点位编号 {0} 开始导入 {1} 个点位吗?</value>
+  </data>
+  <data name="导入点位" xml:space="preserve">
+    <value>导入点位</value>
+  </data>
 </root>
 </root>

+ 1 - 1
TeamAAS-VM/ViewModels/Product/PlcPointParamsViewModel.cs

@@ -971,7 +971,7 @@ namespace TeamAAS_VP.ViewModels.Product
                         int startNumber = view.StartIndex;
                         int startNumber = view.StartIndex;
 
 
                         //弹窗提示用户是否确认要导入从该编号开始的点位,点位数量为cadPoints.Count
                         //弹窗提示用户是否确认要导入从该编号开始的点位,点位数量为cadPoints.Count
-                        if (MessageBox.Show($"确认要从点位编号 {startNumber} 开始导入 {cadPoints.Count} 个点位吗?", "导入点位", MessageBoxButton.YesNo, MessageBoxImage.Question) != MessageBoxResult.Yes)
+                        if (MessageBox.Show( string.Format(Lang.确认要从点位编号0开始导入1个点位吗, startNumber, cadPoints.Count), Lang.导入点位, MessageBoxButton.YesNo, MessageBoxImage.Question) != MessageBoxResult.Yes)
                         {
                         {
                             return;
                             return;
                         }
                         }