From cdc9b1c5070c2c9249443b2c01e5a23f92c30603 Mon Sep 17 00:00:00 2001 From: igeekfan Date: Sat, 21 May 2022 03:07:25 +0800 Subject: [PATCH] =?UTF-8?q?#1108=20=20=E6=8A=8A=E8=8B=B1=E6=96=87=E7=9A=84?= =?UTF-8?q?=E4=BD=9C=E4=B8=BA=E9=BB=98=E8=AE=A4=E8=AF=AD=E8=A8=80=EF=BC=8C?= =?UTF-8?q?=E6=8A=8A=E4=B8=AD=E6=96=87=E6=8D=A2=E6=88=90XXX.zh-Hans.resx?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FreeSql.DbContext/FreeSql.DbContext.csproj | 4 +- FreeSql.DbContext/FreeSql.DbContext.xml | 99 ++++--- .../Properties/DbContextStrings.Designer.cs | 24 +- ...-US.resx => DbContextStrings.zh-Hans.resx} | 84 +++--- .../Properties/CoreStringsTests.cs | 190 ++++++------- .../Properties/DbContextStringsTests.cs | 10 +- FreeSql/FreeSql.xml | 254 +++++++++--------- FreeSql/Properties/CoreStrings.Designer.cs | 26 +- ...gs.en-US.resx => CoreStrings.zh-Hans.resx} | 248 ++++++++--------- FreeSql/Properties/Resources.tt | 29 +- 10 files changed, 528 insertions(+), 440 deletions(-) rename FreeSql.DbContext/Properties/{DbContextStrings.en-US.resx => DbContextStrings.zh-Hans.resx} (70%) rename FreeSql/Properties/{CoreStrings.en-US.resx => CoreStrings.zh-Hans.resx} (54%) diff --git a/FreeSql.DbContext/FreeSql.DbContext.csproj b/FreeSql.DbContext/FreeSql.DbContext.csproj index c6e64311..3c5d56e6 100644 --- a/FreeSql.DbContext/FreeSql.DbContext.csproj +++ b/FreeSql.DbContext/FreeSql.DbContext.csproj @@ -71,11 +71,11 @@ TextTemplatingFileGenerator DbContextStrings.Designer.cs - + Designer FreeSql - + FreeSql diff --git a/FreeSql.DbContext/FreeSql.DbContext.xml b/FreeSql.DbContext/FreeSql.DbContext.xml index 16c38b48..7c926e6b 100644 --- a/FreeSql.DbContext/FreeSql.DbContext.xml +++ b/FreeSql.DbContext/FreeSql.DbContext.xml @@ -266,214 +266,220 @@ + + + 重写当前线程的 CurrentUICulture 属性,对 + 使用此强类型资源类的所有资源查找执行重写。 + + - AddFreeDbContext 发生错误,请检查 {dbContextTypeName} 的构造参数都已正确注入 + An error occurred in AddFreeDbContext, check that the construction parameters of {dbContextTypeName} have been injected correctly - 不可添加,已存在于状态管理:{entityString} + Not addable, already exists in state management: {entityString} - 不可添加,实体没有主键:{entityString} + Not addable, entity has no primary key: {entityString} - 不可添加,未设置主键的值:{entityString} + Not addable, no value for primary key set: {entityString} - 不可添加,自增属性有值:{entityString} + Not addable, self-increasing attribute has value: {entityString} - 不可附加,实体没有主键:{entityString} + Not attachable, entity has no primary key: {entityString} - 不可附加,未设置主键的值:{entityString} + Not attachable, no value for primary key set: {entityString} - 不可删除,数据未被跟踪,应该先查询:{entityString} + Not deletable, data not tracked, should query first: {entityString} - 不可删除,实体没有主键:{entityString} + Not deletable, entity has no primary key: {entityString} - 不可删除,未设置主键的值:{entityString} + Not deletable, no value for primary key set: {entityString} - 不可进行编辑,实体没有主键:{entityString} + Not editable, entity has no primary key: {entityString} - 不可更新,数据未被跟踪,应该先查询 或者 Attach:{entityString} + Not updatable, data not tracked, should be queried first or Attach:{entityString} - 不可更新,实体没有主键:{entityString} + Not updatable, entity has no primary key: {entityString} - 不可更新,未设置主键的值:{entityString} + Not updatable, no value for primary key set: {entityString} - 不可更新,数据库不存在该记录:{entityString} + Not updatable, the record does not exist in the database: {entityString} - 请在 OnConfiguring 或 AddFreeDbContext 中配置 UseFreeSql + Please configure UseFreeSql in OnConfiguring or AddFreeDbContext - DbSet.AsType 参数错误,请传入正确的实体类型 + DbSet. AsType parameter error, please pass in the correct entity type - 实体类型 {EntityTypeName} 无法转换为 {name},无法使用该方法 + Entity type {EntityTypeName} cannot be converted to {name} and cannot use this method - 实体类型 {EntityTypeName} 主键类型不为 {fullName},无法使用该方法 + Entity type {EntityTypeName} Primary key type is not {fullName} and cannot be used with this method - 实体类型 {EntityTypeName} 主键数量不为 1,无法使用该方法 + Entity type {EntityTypeName} Primary key number is not 1 and cannot be used with this method - FreeSql.Repository 设置过滤器失败,原因是对象不属于 IRepository + FreeSql. Repository failed to set filter because object does not belong to IRepository - 不可比较,实体没有主键:{entityString} + Not comparable, entity has no primary key: {entityString} - 不可比较,未设置主键的值:{entityString} + Non-comparable, no value for primary key set: {entityString} - FreeSql.Repository Insert 失败,因为设置了过滤器 {filterKey}: {filterValueExpression},插入的数据不符合 {entityString} + FreeSql. Repository Insert failed because the filter {filterKey}: {filterValueExpression} was set and the inserted data does not conform to {entityString} - ISelect.AsType 参数不支持指定为 object + ISelect. AsType parameter does not support specifying as object - {tableTypeFullName} 不存在属性 {propertyName} + Property {propertyName} does not exist for {tableTypeFullName} - 找不到方法 DbSet<>.StatesRemoveByObjects + Method DbSet<> not found. StatesRemoveByObjects - 参数 data 类型错误 {entityTypeFullName} + Parameter data type error {entityTypeFullName} - 参数错误 {param} + Parameter error {param} - 参数错误 {param} 不能为 null + Parameter error {param} cannot be null - 参数错误 {many} 不是集合属性 + Parameter error {many} is not a collection property - 参数错误 {many} 集合属性不存在 + Parameter error {many} Collection property does not exist - 参数错误 {one} 属性不存在 + Parameter error {one} attribute does not exist - Propagation_Mandatory: 使用当前事务,如果没有当前事务,就抛出异常 + Propagation_ Mandatory: With the current transaction, throw an exception if there is no current transaction - Propagation_Never: 以非事务方式执行操作,如果当前事务存在则抛出异常 + Propagation_ Never: Perform the operation non-transactionally and throw an exception if the current transaction exists - {tableTypeFullName} 类型的属性 {propertyName} 不是 OneToMany 或 ManyToMany 特性 + Property {propertyName} of type {tableTypeFullName} is not OneToMany or ManyToMany attribute - 特别错误:批量添加失败,{dataType} 的返回数据,与添加的数目不匹配 + Special error: Bulk add failed, {dataType} returned data, does not match the number added - 特别错误:更新失败,数据未被跟踪:{entityString} + Special error: Update failed, data not tracked: {entityString} - 已开启事务,不能禁用工作单元 + Transaction opened, unit of work cannot be disabled - {tableTypeFullName} 类型已设置属性 {propertyName} 忽略特性 + The {tableTypeFullName} type has set the property {propertyName} Ignore the attribute - {unitOfWorkManager} 构造参数 {fsql} 不能为 null + The {unitOfWorkManager} constructor parameter {fsql} cannot be null - FreeSql.Repository Update 失败,因为设置了过滤器 {filterKey}: {filterValueExpression},更新的数据不符合{entityString} + FreeSql. Repository Update failed because the filter {filterKey}: {filterValueExpression} is set and the updated data does not conform to {entityString} @@ -780,5 +786,14 @@ + + + 批量注入 Repository,可以参考代码自行调整 + + + + + + diff --git a/FreeSql.DbContext/Properties/DbContextStrings.Designer.cs b/FreeSql.DbContext/Properties/DbContextStrings.Designer.cs index 44a9fd7d..ff2b54c4 100644 --- a/FreeSql.DbContext/Properties/DbContextStrings.Designer.cs +++ b/FreeSql.DbContext/Properties/DbContextStrings.Designer.cs @@ -4,6 +4,7 @@ using System; using System.Reflection; using System.Resources; +using System.Globalization; using System.Threading; namespace FreeSql @@ -19,8 +20,25 @@ namespace FreeSql /// public static class DbContextStrings { - private static readonly ResourceManager _resourceManager - = new ResourceManager("FreeSql.DbContext.Properties.DbContextStrings", typeof(DbContextStrings).Assembly); + private static readonly ResourceManager _resourceManager = new ResourceManager("FreeSql.DbContext.Properties.DbContextStrings", typeof(DbContextStrings).Assembly); + + private static CultureInfo _resourceCulture; + + /// + /// 重写当前线程的 CurrentUICulture 属性,对 + /// 使用此强类型资源类的所有资源查找执行重写。 + /// + public static CultureInfo Culture + { + get + { + return _resourceCulture; + } + set + { + _resourceCulture = value; + } + } /// /// AddFreeDbContext 发生错误,请检查 {dbContextTypeName} 的构造参数都已正确注入 @@ -344,7 +362,7 @@ namespace FreeSql private static string GetString(string name, params string[] formatterNames) { - var value = _resourceManager.GetString(name); + var value = _resourceManager.GetString(name,_resourceCulture); for (var i = 0; i < formatterNames.Length; i++) { value = value.Replace("{" + formatterNames[i] + "}", "{" + i + "}"); diff --git a/FreeSql.DbContext/Properties/DbContextStrings.en-US.resx b/FreeSql.DbContext/Properties/DbContextStrings.zh-Hans.resx similarity index 70% rename from FreeSql.DbContext/Properties/DbContextStrings.en-US.resx rename to FreeSql.DbContext/Properties/DbContextStrings.zh-Hans.resx index 5b694b09..ce01210d 100644 --- a/FreeSql.DbContext/Properties/DbContextStrings.en-US.resx +++ b/FreeSql.DbContext/Properties/DbContextStrings.zh-Hans.resx @@ -118,129 +118,129 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - An error occurred in AddFreeDbContext, check that the construction parameters of {dbContextTypeName} have been injected correctly + AddFreeDbContext 发生错误,请检查 {dbContextTypeName} 的构造参数都已正确注入 - Not addable, already exists in state management: {entityString} + 不可添加,已存在于状态管理:{entityString} - Not addable, entity has no primary key: {entityString} + 不可添加,实体没有主键:{entityString} - Not addable, no value for primary key set: {entityString} + 不可添加,未设置主键的值:{entityString} - Not addable, self-increasing attribute has value: {entityString} + 不可添加,自增属性有值:{entityString} - Not attachable, entity has no primary key: {entityString} + 不可附加,实体没有主键:{entityString} - Not attachable, no value for primary key set: {entityString} + 不可附加,未设置主键的值:{entityString} - Not deletable, data not tracked, should query first: {entityString} + 不可删除,数据未被跟踪,应该先查询:{entityString} - Not deletable, entity has no primary key: {entityString} + 不可删除,实体没有主键:{entityString} - Not deletable, no value for primary key set: {entityString} + 不可删除,未设置主键的值:{entityString} - Not editable, entity has no primary key: {entityString} + 不可进行编辑,实体没有主键:{entityString} - Not updatable, data not tracked, should be queried first or Attach:{entityString} + 不可更新,数据未被跟踪,应该先查询 或者 Attach:{entityString} - Not updatable, entity has no primary key: {entityString} + 不可更新,实体没有主键:{entityString} - Not updatable, no value for primary key set: {entityString} + 不可更新,未设置主键的值:{entityString} - Not updatable, the record does not exist in the database: {entityString} + 不可更新,数据库不存在该记录:{entityString} - Please configure UseFreeSql in OnConfiguring or AddFreeDbContext + 请在 OnConfiguring 或 AddFreeDbContext 中配置 UseFreeSql - DbSet. AsType parameter error, please pass in the correct entity type + DbSet.AsType 参数错误,请传入正确的实体类型 - Entity type {EntityTypeName} cannot be converted to {name} and cannot use this method + 实体类型 {EntityTypeName} 无法转换为 {name},无法使用该方法 - Entity type {EntityTypeName} Primary key type is not {fullName} and cannot be used with this method + 实体类型 {EntityTypeName} 主键类型不为 {fullName},无法使用该方法 - Entity type {EntityTypeName} Primary key number is not 1 and cannot be used with this method + 实体类型 {EntityTypeName} 主键数量不为 1,无法使用该方法 - FreeSql. Repository failed to set filter because object does not belong to IRepository + FreeSql.Repository 设置过滤器失败,原因是对象不属于 IRepository - Not comparable, entity has no primary key: {entityString} + 不可比较,实体没有主键:{entityString} - Non-comparable, no value for primary key set: {entityString} + 不可比较,未设置主键的值:{entityString} - FreeSql. Repository Insert failed because the filter {filterKey}: {filterValueExpression} was set and the inserted data does not conform to {entityString} + FreeSql.Repository Insert 失败,因为设置了过滤器 {filterKey}: {filterValueExpression},插入的数据不符合 {entityString} - ISelect. AsType parameter does not support specifying as object + ISelect.AsType 参数不支持指定为 object - Property {propertyName} does not exist for {tableTypeFullName} + {tableTypeFullName} 不存在属性 {propertyName} - Method DbSet<> not found. StatesRemoveByObjects + 找不到方法 DbSet<>.StatesRemoveByObjects - Parameter data type error {entityTypeFullName} + 参数 data 类型错误 {entityTypeFullName} - Parameter error {param} + 参数错误 {param} - Parameter error {param} cannot be null + 参数错误 {param} 不能为 null - Parameter error {many} is not a collection property + 参数错误 {many} 不是集合属性 - Parameter error {many} Collection property does not exist + 参数错误 {many} 集合属性不存在 - Parameter error {one} attribute does not exist + 参数错误 {one} 属性不存在 - Propagation_ Mandatory: With the current transaction, throw an exception if there is no current transaction + Propagation_Mandatory: 使用当前事务,如果没有当前事务,就抛出异常 - Propagation_ Never: Perform the operation non-transactionally and throw an exception if the current transaction exists + Propagation_Never: 以非事务方式执行操作,如果当前事务存在则抛出异常 - Property {propertyName} of type {tableTypeFullName} is not OneToMany or ManyToMany attribute + {tableTypeFullName} 类型的属性 {propertyName} 不是 OneToMany 或 ManyToMany 特性 - Special error: Bulk add failed, {dataType} returned data, does not match the number added + 特别错误:批量添加失败,{dataType} 的返回数据,与添加的数目不匹配 - Special error: Update failed, data not tracked: {entityString} + 特别错误:更新失败,数据未被跟踪:{entityString} - Transaction opened, unit of work cannot be disabled + 已开启事务,不能禁用工作单元 - The {tableTypeFullName} type has set the property {propertyName} Ignore the attribute + {tableTypeFullName} 类型已设置属性 {propertyName} 忽略特性 - The {unitOfWorkManager} constructor parameter {fsql} cannot be null + {unitOfWorkManager} 构造参数 {fsql} 不能为 null - FreeSql. Repository Update failed because the filter {filterKey}: {filterValueExpression} is set and the updated data does not conform to {entityString} + FreeSql.Repository Update 失败,因为设置了过滤器 {filterKey}: {filterValueExpression},更新的数据不符合{entityString} \ No newline at end of file diff --git a/FreeSql.Tests/FreeSql.Tests/Properties/CoreStringsTests.cs b/FreeSql.Tests/FreeSql.Tests/Properties/CoreStringsTests.cs index d9f547e6..9c063622 100644 --- a/FreeSql.Tests/FreeSql.Tests/Properties/CoreStringsTests.cs +++ b/FreeSql.Tests/FreeSql.Tests/Properties/CoreStringsTests.cs @@ -11,20 +11,28 @@ namespace FreeSql.Tests.Properties public CoreStringsTests(ITestOutputHelper output) { this.output = output; - Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US"); - Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US"); + //Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("zh-Hans"); + //Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("zh-Hans"); + + //Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US"); + //Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US"); + + //CoreStrings.Culture= new System.Globalization.CultureInfo("zh-CN"); + CoreStrings.Culture = new System.Globalization.CultureInfo("en-US"); } [Fact] public void AsTable_PropertyName_NotDateTimeTest() { - string text = CoreStrings.AsTable_PropertyName_NotDateTime("1 "); + var x = CoreStrings.CustomFieldSeparatedBySpaces; + x = CoreStrings.Custom_StaticMethodName_IsNotNull; + string text = CoreStrings.AsTable_PropertyName_NotDateTime("1"); output.WriteLine(text); } [Fact] public void AsTable_PropertyName_FormatErrorTest() { - string text = CoreStrings.AsTable_PropertyName_FormatError("1 "); + string text = CoreStrings.AsTable_PropertyName_FormatError("1"); output.WriteLine(text); } @@ -32,119 +40,119 @@ namespace FreeSql.Tests.Properties [Fact] public void Available_Failed_Get_ResourceTest() { - string text = CoreStrings.Available_Failed_Get_Resource("1", "2 "); + string text = CoreStrings.Available_Failed_Get_Resource("1", "2"); output.WriteLine(text); } [Fact] public void Available_Thrown_ExceptionTest() { - string text = CoreStrings.Available_Thrown_Exception("1 "); + string text = CoreStrings.Available_Thrown_Exception("1"); output.WriteLine(text); } [Fact] public void Bad_Expression_FormatTest() { - string text = CoreStrings.Bad_Expression_Format("1 "); + string text = CoreStrings.Bad_Expression_Format("1"); output.WriteLine(text); } [Fact] public void Cannot_Be_NULL_NameTest() { - string text = CoreStrings.Cannot_Be_NULL_Name("1 "); + string text = CoreStrings.Cannot_Be_NULL_Name("1"); output.WriteLine(text); } [Fact] public void Cannot_Match_PropertyTest() { - string text = CoreStrings.Cannot_Match_Property("1 "); + string text = CoreStrings.Cannot_Match_Property("1"); output.WriteLine(text); } [Fact] public void Cannot_Resolve_ExpressionTreeTest() { - string text = CoreStrings.Cannot_Resolve_ExpressionTree("1 "); + string text = CoreStrings.Cannot_Resolve_ExpressionTree("1"); output.WriteLine(text); } [Fact] public void Custom_Expression_ParsingErrorTest() { - string text = CoreStrings.Custom_Expression_ParsingError("1 "); + string text = CoreStrings.Custom_Expression_ParsingError("1"); output.WriteLine(text); } [Fact] public void Custom_StaticMethodName_NotSet_DynamicFilterCustomTest() { - string text = CoreStrings.Custom_StaticMethodName_NotSet_DynamicFilterCustom("1 "); + string text = CoreStrings.Custom_StaticMethodName_NotSet_DynamicFilterCustom("1"); output.WriteLine(text); } [Fact] public void DataType_AsType_InconsistentTest() { - string text = CoreStrings.DataType_AsType_Inconsistent("1", "2 "); + string text = CoreStrings.DataType_AsType_Inconsistent("1", "2"); output.WriteLine(text); } [Fact] public void DbUpdateVersionException_RowLevelOptimisticLockTest() { - string text = CoreStrings.DbUpdateVersionException_RowLevelOptimisticLock("1", "2 "); + string text = CoreStrings.DbUpdateVersionException_RowLevelOptimisticLock("1", "2"); output.WriteLine(text); } [Fact] public void Duplicate_ColumnAttributeTest() { - string text = CoreStrings.Duplicate_ColumnAttribute("1 "); + string text = CoreStrings.Duplicate_ColumnAttribute("1"); output.WriteLine(text); } [Fact] public void Duplicate_PropertyNameTest() { - string text = CoreStrings.Duplicate_PropertyName("1 "); + string text = CoreStrings.Duplicate_PropertyName("1"); output.WriteLine(text); } [Fact] public void Entity_Must_Primary_KeyTest() { - string text = CoreStrings.Entity_Must_Primary_Key("1", "2 "); + string text = CoreStrings.Entity_Must_Primary_Key("1", "2"); output.WriteLine(text); } [Fact] public void Entity_MySQL_VersionsBelow8_NotSupport_Multiple_PrimaryKeysTest() { - string text = CoreStrings.Entity_MySQL_VersionsBelow8_NotSupport_Multiple_PrimaryKeys("1 "); + string text = CoreStrings.Entity_MySQL_VersionsBelow8_NotSupport_Multiple_PrimaryKeys("1"); output.WriteLine(text); } [Fact] public void Entity_NotParentChild_RelationshipTest() { - string text = CoreStrings.Entity_NotParentChild_Relationship("1 "); + string text = CoreStrings.Entity_NotParentChild_Relationship("1"); output.WriteLine(text); } [Fact] public void Expression_Error_Use_ParameterExpressionTest() { - string text = CoreStrings.Expression_Error_Use_ParameterExpression("1 "); + string text = CoreStrings.Expression_Error_Use_ParameterExpression("1"); output.WriteLine(text); } [Fact] public void Expression_Error_Use_Successive_MemberAccess_TypeTest() { - string text = CoreStrings.Expression_Error_Use_Successive_MemberAccess_Type("1 "); + string text = CoreStrings.Expression_Error_Use_Successive_MemberAccess_Type("1"); output.WriteLine(text); } @@ -158,322 +166,322 @@ namespace FreeSql.Tests.Properties [Fact] public void Failed_SubTable_FieldValueTest() { - string text = CoreStrings.Failed_SubTable_FieldValue("1 "); + string text = CoreStrings.Failed_SubTable_FieldValue("1"); output.WriteLine(text); } [Fact] public void Functions_AsTable_NotImplementedTest() { - string text = CoreStrings.Functions_AsTable_NotImplemented("1 "); + string text = CoreStrings.Functions_AsTable_NotImplemented("1"); output.WriteLine(text); } [Fact] public void Generated_Same_SubTableTest() { - string text = CoreStrings.Generated_Same_SubTable("1 "); + string text = CoreStrings.Generated_Same_SubTable("1"); output.WriteLine(text); } [Fact] public void GetPrimarys_ParameterError_IsNotDictKeyTest() { - string text = CoreStrings.GetPrimarys_ParameterError_IsNotDictKey("1 "); + string text = CoreStrings.GetPrimarys_ParameterError_IsNotDictKey("1"); output.WriteLine(text); } [Fact] public void Has_Specified_Cannot_Specified_SecondTest() { - string text = CoreStrings.Has_Specified_Cannot_Specified_Second("1", "2 "); + string text = CoreStrings.Has_Specified_Cannot_Specified_Second("1", "2"); output.WriteLine(text); } [Fact] public void Ignored_Check_Confirm_PublicGetSetTest() { - string text = CoreStrings.Ignored_Check_Confirm_PublicGetSet("1", "2 "); + string text = CoreStrings.Ignored_Check_Confirm_PublicGetSet("1", "2"); output.WriteLine(text); } [Fact] public void IncludeMany_NotValid_NavigationTest() { - string text = CoreStrings.IncludeMany_NotValid_Navigation("1", "2 "); + string text = CoreStrings.IncludeMany_NotValid_Navigation("1", "2"); output.WriteLine(text); } [Fact] public void IncludeMany_ParameterError_OnlyUseOneParameterTest() { - string text = CoreStrings.IncludeMany_ParameterError_OnlyUseOneParameter("1 "); + string text = CoreStrings.IncludeMany_ParameterError_OnlyUseOneParameter("1"); output.WriteLine(text); } [Fact] public void IncludeMany_ParameterError_Select_ReturnConsistentTypeTest() { - string text = CoreStrings.IncludeMany_ParameterError_Select_ReturnConsistentType("1", "2 "); + string text = CoreStrings.IncludeMany_ParameterError_Select_ReturnConsistentType("1", "2"); output.WriteLine(text); } [Fact] public void IncludeMany_ParameterTypeErrorTest() { - string text = CoreStrings.IncludeMany_ParameterTypeError("1 "); + string text = CoreStrings.IncludeMany_ParameterTypeError("1"); output.WriteLine(text); } [Fact] public void InsertInto_No_Property_SelectedTest() { - string text = CoreStrings.InsertInto_No_Property_Selected("1 "); + string text = CoreStrings.InsertInto_No_Property_Selected("1"); output.WriteLine(text); } [Fact] public void InsertInto_TypeErrorTest() { - string text = CoreStrings.InsertInto_TypeError("1 "); + string text = CoreStrings.InsertInto_TypeError("1"); output.WriteLine(text); } [Fact] public void InsertOrUpdate_Must_Primary_KeyTest() { - string text = CoreStrings.InsertOrUpdate_Must_Primary_Key("1 "); + string text = CoreStrings.InsertOrUpdate_Must_Primary_Key("1"); output.WriteLine(text); } [Fact] public void InsertOrUpdate_NotSuport_Generic_UseEntityTest() { - string text = CoreStrings.InsertOrUpdate_NotSuport_Generic_UseEntity("1 "); + string text = CoreStrings.InsertOrUpdate_NotSuport_Generic_UseEntity("1"); output.WriteLine(text); } [Fact] public void LazyLoading_CompilationErrorTest() { - string text = CoreStrings.LazyLoading_CompilationError("1", "2", "2 "); + string text = CoreStrings.LazyLoading_CompilationError("1", "2", "2"); output.WriteLine(text); } [Fact] public void LazyLoading_EntityMustDeclarePublicTest() { - string text = CoreStrings.LazyLoading_EntityMustDeclarePublic("1 "); + string text = CoreStrings.LazyLoading_EntityMustDeclarePublic("1"); output.WriteLine(text); } [Fact] public void ManyToMany_NotFound_CorrespondingFieldTest() { - string text = CoreStrings.ManyToMany_NotFound_CorrespondingField("1", "2", "2", "2", "2 "); + string text = CoreStrings.ManyToMany_NotFound_CorrespondingField("1", "2", "2", "2", "2"); output.WriteLine(text); } [Fact] public void ManyToMany_ParsingError_EntityMissing_PrimaryKeyTest() { - string text = CoreStrings.ManyToMany_ParsingError_EntityMissing_PrimaryKey("1", "2", "2 "); + string text = CoreStrings.ManyToMany_ParsingError_EntityMissing_PrimaryKey("1", "2", "2"); output.WriteLine(text); } [Fact] public void ManyToMany_ParsingError_EntityMustHas_NavigateCollectionTest() { - string text = CoreStrings.ManyToMany_ParsingError_EntityMustHas_NavigateCollection("1", "2", "2 "); + string text = CoreStrings.ManyToMany_ParsingError_EntityMustHas_NavigateCollection("1", "2", "2"); output.WriteLine(text); } [Fact] public void ManyToMany_ParsingError_InconsistentTypeTest() { - string text = CoreStrings.ManyToMany_ParsingError_InconsistentType("1", "2", "2", "2", "2", "2 "); + string text = CoreStrings.ManyToMany_ParsingError_InconsistentType("1", "2", "2", "2", "2", "2"); output.WriteLine(text); } [Fact] public void ManyToMany_ParsingError_IntermediateClass_ErrorMessageTest() { - string text = CoreStrings.ManyToMany_ParsingError_IntermediateClass_ErrorMessage("1", "2", "2", "2", "2 "); + string text = CoreStrings.ManyToMany_ParsingError_IntermediateClass_ErrorMessage("1", "2", "2", "2", "2"); output.WriteLine(text); } [Fact] public void ManyToMany_ParsingError_IntermediateClass_NotManyToOne_OneToOneTest() { - string text = CoreStrings.ManyToMany_ParsingError_IntermediateClass_NotManyToOne_OneToOne("1", "2", "2", "2 "); + string text = CoreStrings.ManyToMany_ParsingError_IntermediateClass_NotManyToOne_OneToOne("1", "2", "2", "2"); output.WriteLine(text); } [Fact] public void Mapping_Exception_HasNo_SamePropertyNameTest() { - string text = CoreStrings.Mapping_Exception_HasNo_SamePropertyName("1 "); + string text = CoreStrings.Mapping_Exception_HasNo_SamePropertyName("1"); output.WriteLine(text); } [Fact] public void Missing_FreeSqlProvider_PackageTest() { - string text = CoreStrings.Missing_FreeSqlProvider_Package("1 "); + string text = CoreStrings.Missing_FreeSqlProvider_Package("1"); output.WriteLine(text); } [Fact] public void Missing_FreeSqlProvider_Package_ReasonTest() { - string text = CoreStrings.Missing_FreeSqlProvider_Package_Reason("1", "2 "); + string text = CoreStrings.Missing_FreeSqlProvider_Package_Reason("1", "2"); output.WriteLine(text); } [Fact] public void Navigation_Bind_Number_DifferentTest() { - string text = CoreStrings.Navigation_Bind_Number_Different("1", "2", "2", "2 "); + string text = CoreStrings.Navigation_Bind_Number_Different("1", "2", "2", "2"); output.WriteLine(text); } [Fact] public void Navigation_Missing_AsSelectTest() { - string text = CoreStrings.Navigation_Missing_AsSelect("1", "2 "); + string text = CoreStrings.Navigation_Missing_AsSelect("1", "2"); output.WriteLine(text); } [Fact] public void Navigation_Missing_SetPropertyTest() { - string text = CoreStrings.Navigation_Missing_SetProperty("1", "2 "); + string text = CoreStrings.Navigation_Missing_SetProperty("1", "2"); output.WriteLine(text); } [Fact] public void Navigation_NotFound_CorrespondingFieldTest() { - string text = CoreStrings.Navigation_NotFound_CorrespondingField("1", "2", "2 "); + string text = CoreStrings.Navigation_NotFound_CorrespondingField("1", "2", "2"); output.WriteLine(text); } [Fact] public void Navigation_ParsingError_EntityMissingPrimaryKeyTest() { - string text = CoreStrings.Navigation_ParsingError_EntityMissingPrimaryKey("1", "2", "2 "); + string text = CoreStrings.Navigation_ParsingError_EntityMissingPrimaryKey("1", "2", "2"); output.WriteLine(text); } [Fact] public void Navigation_ParsingError_InconsistentTypeTest() { - string text = CoreStrings.Navigation_ParsingError_InconsistentType("1", "2", "2", "2", "2", "2 "); + string text = CoreStrings.Navigation_ParsingError_InconsistentType("1", "2", "2", "2", "2", "2"); output.WriteLine(text); } [Fact] public void Navigation_ParsingError_NotFound_PropertyTest() { - string text = CoreStrings.Navigation_ParsingError_NotFound_Property("1", "2", "2", "2 "); + string text = CoreStrings.Navigation_ParsingError_NotFound_Property("1", "2", "2", "2"); output.WriteLine(text); } [Fact] public void NoPrimaryKey_UseSetDtoTest() { - string text = CoreStrings.NoPrimaryKey_UseSetDto("1 "); + string text = CoreStrings.NoPrimaryKey_UseSetDto("1"); output.WriteLine(text); } [Fact] public void Not_Implemented_ExpressionTest() { - string text = CoreStrings.Not_Implemented_Expression("1 "); + string text = CoreStrings.Not_Implemented_Expression("1"); output.WriteLine(text); } [Fact] public void Not_Implemented_Expression_ParameterUseConstantTest() { - string text = CoreStrings.Not_Implemented_Expression_ParameterUseConstant("1", "2 "); + string text = CoreStrings.Not_Implemented_Expression_ParameterUseConstant("1", "2"); output.WriteLine(text); } [Fact] public void Not_Implemented_Expression_UseAsSelectTest() { - string text = CoreStrings.Not_Implemented_Expression_UseAsSelect("1", "2", "2 "); + string text = CoreStrings.Not_Implemented_Expression_UseAsSelect("1", "2", "2"); output.WriteLine(text); } [Fact] public void Not_Implemented_NameTest() { - string text = CoreStrings.Not_Implemented_Name("1 "); + string text = CoreStrings.Not_Implemented_Name("1"); output.WriteLine(text); } [Fact] public void Not_Support_OrderByRandomTest() { - string text = CoreStrings.Not_Support_OrderByRandom("1 "); + string text = CoreStrings.Not_Support_OrderByRandom("1"); output.WriteLine(text); } [Fact] public void Not_Valid_Navigation_PropertyTest() { - string text = CoreStrings.Not_Valid_Navigation_Property("1 "); + string text = CoreStrings.Not_Valid_Navigation_Property("1"); output.WriteLine(text); } [Fact] public void NotFound_ColumnTest() { - string text = CoreStrings.NotFound_Column("1", "2 "); + string text = CoreStrings.NotFound_Column("1", "2"); output.WriteLine(text); } [Fact] public void NotFound_CsName_ColumnTest() { - string text = CoreStrings.NotFound_Column("1", "2 "); + string text = CoreStrings.NotFound_Column("1", "2"); output.WriteLine(text); } [Fact] public void NotFound_PropertyTest() { - string text = CoreStrings.NotFound_Property("1 "); + string text = CoreStrings.NotFound_Property("1"); output.WriteLine(text); } [Fact] public void NotFound_PropertyNameTest() { - string text = CoreStrings.NotFound_PropertyName("1 "); + string text = CoreStrings.NotFound_PropertyName("1"); output.WriteLine(text); } [Fact] public void NotFound_ReflectionTest() { - string text = CoreStrings.NotFound_Reflection("1 "); + string text = CoreStrings.NotFound_Reflection("1"); output.WriteLine(text); } [Fact] public void NotFound_Static_MethodNameTest() { - string text = CoreStrings.NotFound_Static_MethodName("1 "); + string text = CoreStrings.NotFound_Static_MethodName("1"); output.WriteLine(text); } [Fact] public void NotFound_Table_Property_AsTableTest() { - string text = CoreStrings.NotFound_Table_Property_AsTable("1 "); + string text = CoreStrings.NotFound_Table_Property_AsTable("1"); output.WriteLine(text); } @@ -487,119 +495,119 @@ namespace FreeSql.Tests.Properties [Fact] public void ObjectPool_GetAsync_Queue_LongTest() { - string text = CoreStrings.ObjectPool_GetAsync_Queue_Long("1", "2 "); + string text = CoreStrings.ObjectPool_GetAsync_Queue_Long("1", "2"); output.WriteLine(text); } [Fact] public void OneToMany_NotFound_CorrespondingFieldTest() { - string text = CoreStrings.OneToMany_NotFound_CorrespondingField("1", "2", "2", "2", "2 "); + string text = CoreStrings.OneToMany_NotFound_CorrespondingField("1", "2", "2", "2", "2"); output.WriteLine(text); } [Fact] public void OneToMany_ParsingError_InconsistentTypeTest() { - string text = CoreStrings.OneToMany_ParsingError_InconsistentType("1", "2", "2", "2", "2", "2 "); + string text = CoreStrings.OneToMany_ParsingError_InconsistentType("1", "2", "2", "2", "2", "2"); output.WriteLine(text); } [Fact] public void OneToMany_UseNavigateTest() { - string text = CoreStrings.OneToMany_UseNavigate("1", "2 "); + string text = CoreStrings.OneToMany_UseNavigate("1", "2"); output.WriteLine(text); } [Fact] public void ParameterError_NotValid_CollectionTest() { - string text = CoreStrings.ParameterError_NotValid_Collection("1 "); + string text = CoreStrings.ParameterError_NotValid_Collection("1"); output.WriteLine(text); } [Fact] public void ParameterError_NotValid_NavigationTest() { - string text = CoreStrings.ParameterError_NotValid_Navigation("1 "); + string text = CoreStrings.ParameterError_NotValid_Navigation("1"); output.WriteLine(text); } [Fact] public void ParameterError_NotValid_PropertyNameTest() { - string text = CoreStrings.ParameterError_NotValid_PropertyName("1", "2", "2 "); + string text = CoreStrings.ParameterError_NotValid_PropertyName("1", "2", "2"); output.WriteLine(text); } [Fact] public void ParameterError_NotValid_UseCommasTest() { - string text = CoreStrings.ParameterError_NotValid_UseCommas("1 "); + string text = CoreStrings.ParameterError_NotValid_UseCommas("1"); output.WriteLine(text); } [Fact] public void Parsing_FailedTest() { - string text = CoreStrings.Parsing_Failed("1", "2 "); + string text = CoreStrings.Parsing_Failed("1", "2"); output.WriteLine(text); } [Fact] public void Policy_ObjectPool_DisposeTest() { - string text = CoreStrings.Policy_ObjectPool_Dispose("1 "); + string text = CoreStrings.Policy_ObjectPool_Dispose("1"); output.WriteLine(text); } [Fact] public void Policy_Status_NotAvailableTest() { - string text = CoreStrings.Policy_Status_NotAvailable("1", "2 "); + string text = CoreStrings.Policy_Status_NotAvailable("1", "2"); output.WriteLine(text); } [Fact] public void Properties_AsRowLock_Must_Numeric_ByteTest() { - string text = CoreStrings.Properties_AsRowLock_Must_Numeric_Byte("1 "); + string text = CoreStrings.Properties_AsRowLock_Must_Numeric_Byte("1"); output.WriteLine(text); } [Fact] public void Property_Cannot_FindTest() { - string text = CoreStrings.Property_Cannot_Find("1 "); + string text = CoreStrings.Property_Cannot_Find("1"); output.WriteLine(text); } [Fact] public void Set_Column_IsNullable_FalseTest() { - string text = CoreStrings.Set_Column_IsNullable_False("1 "); + string text = CoreStrings.Set_Column_IsNullable_False("1"); output.WriteLine(text); } [Fact] public void SubTableFieldValue_CannotLessThenTest() { - string text = CoreStrings.SubTableFieldValue_CannotLessThen("1", "2 "); + string text = CoreStrings.SubTableFieldValue_CannotLessThen("1", "2"); output.WriteLine(text); } [Fact] public void SubTableFieldValue_NotConvertDateTimeTest() { - string text = CoreStrings.SubTableFieldValue_NotConvertDateTime("1 "); + string text = CoreStrings.SubTableFieldValue_NotConvertDateTime("1"); output.WriteLine(text); } [Fact] public void SubTableFieldValue_NotMatchTableTest() { - string text = CoreStrings.SubTableFieldValue_NotConvertDateTime("1 "); + string text = CoreStrings.SubTableFieldValue_NotConvertDateTime("1"); output.WriteLine(text); } @@ -607,49 +615,49 @@ namespace FreeSql.Tests.Properties [Fact] public void Type_AsType_Parameter_ErrorTest() { - string text = CoreStrings.Type_AsType_Parameter_Error("1 "); + string text = CoreStrings.Type_AsType_Parameter_Error("1"); output.WriteLine(text); } [Fact] public void Type_Cannot_Access_ConstructorTest() { - string text = CoreStrings.Type_Cannot_Access_Constructor("1 "); + string text = CoreStrings.Type_Cannot_Access_Constructor("1"); output.WriteLine(text); } [Fact] public void Type_Error_NameTest() { - string text = CoreStrings.Type_Error_Name("1 "); + string text = CoreStrings.Type_Error_Name("1"); output.WriteLine(text); } [Fact] public void TypeAsType_NotSupport_ObjectTest() { - string text = CoreStrings.TypeAsType_NotSupport_Object("1 "); + string text = CoreStrings.TypeAsType_NotSupport_Object("1"); output.WriteLine(text); } [Fact] public void TypeError_CannotUse_IncludeManyTest() { - string text = CoreStrings.TypeError_CannotUse_IncludeMany("1 "); + string text = CoreStrings.TypeError_CannotUse_IncludeMany("1"); output.WriteLine(text); } [Fact] public void Unable_Parse_ExpressionTest() { - string text = CoreStrings.Unable_Parse_Expression("1 "); + string text = CoreStrings.Unable_Parse_Expression("1"); output.WriteLine(text); } [Fact] public void Unable_Parse_ExpressionMethodTest() { - string text = CoreStrings.Unable_Parse_ExpressionMethod("1 "); + string text = CoreStrings.Unable_Parse_ExpressionMethod("1"); output.WriteLine(text); } diff --git a/FreeSql.Tests/FreeSql.Tests/Properties/DbContextStringsTests.cs b/FreeSql.Tests/FreeSql.Tests/Properties/DbContextStringsTests.cs index cdfa205c..aa4d1d24 100644 --- a/FreeSql.Tests/FreeSql.Tests/Properties/DbContextStringsTests.cs +++ b/FreeSql.Tests/FreeSql.Tests/Properties/DbContextStringsTests.cs @@ -15,8 +15,14 @@ namespace FreeSql.Tests.Properties public DbContextStringsTests(ITestOutputHelper output) { this.output = output; - Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US"); - Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US"); + //Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("zh-Hans"); + //Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("zh-Hans"); + + //Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US"); + //Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US"); + + //DbContextStrings.Culture= new System.Globalization.CultureInfo("zh-CN"); + DbContextStrings.Culture = new System.Globalization.CultureInfo("en-US"); } [Fact] diff --git a/FreeSql/FreeSql.xml b/FreeSql/FreeSql.xml index 1d32bd1f..2a07e30b 100644 --- a/FreeSql/FreeSql.xml +++ b/FreeSql/FreeSql.xml @@ -4603,14 +4603,20 @@ + + + 重写当前线程的 CurrentUICulture 属性,对 + 使用此强类型资源类的所有资源查找执行重写。 + + - [Table(AsTable = "{asTable}")] 特性值格式错误 + [Table(AsTable="{asTable}")] Property value formatted incorrectly - [Table(AsTable = xx)] 设置的属性名 {atmGroupsValue} 不是 DateTime 类型 + The property name {atmGroupsValue} set by [Table (AsTable = xx)] is not of type DateTime @@ -4625,612 +4631,612 @@ - 错误的表达式格式 {column} + Wrong expression format {column} - Chunk 功能之前不可使用 Select + Select is not available until the Chunk function - 安全起见,请务必在事务开启之后,再使用 ForUpdate + For security reasons, be sure to use ForUpdate after the transaction is open - 不能为 null + Cannot be null - {name} 不能为 null + {name} cannot be null - 无法匹配 {property} + Unable to match {property} - {property} 无法解析为表达式树 + {property} cannot be resolved to an expression tree - 参数 masterConnectionString 不可为空,请检查 UseConnectionString + The parameter master ConnectionString cannot be empty, check UseConnectionString - 提交 + Commit - 连接失败,准备切换其他可用服务器 + Connection failed, ready to switch other available servers - 自定义表达式解析错误:类型 {exp3MethodDeclaringType} 需要定义 static ThreadLocal<ExpressionCallContext> 字段、字段、字段(重要三次提醒) + Custom expression parsing error: type {exp3MethodDeclaringType} needs to define static ThreadLocal<ExpressionCallContext>field, field, field (important three reminders) - Custom { 反射信息 }不能为空,格式:{ 静态方法名 }{ 空格 }{ 反射信息 } + Custom {Reflection Information} cannot be empty, format: { static method name }{ space }{ reflection information } - Custom { 静态方法名 }不能为空,格式:{ 静态方法名 }{ 空格 }{ 反射信息 } + Custom { static method name } cannot be empty, format: { static method name }{ space }{ reflection information } - Custom 对应的{{ 静态方法名 }}:{fiValueCustomArray} 未设置 [DynamicFilterCustomAttribute] 特性 + Custom corresponding {{ static method name }}:{fiValueCustomArray} The [DynamicFilterCustomAttribute] attribute is not set - Custom 要求 Field 应该空格分割,并且长度为 2,格式:{ 静态方法名 }{ 空格 }{ 反射信息 } + Custom requires that Fields be space-split and 2-length in the format: { static method name }{ space }{ reflection information } - 操作的数据类型({dataDisplayCsharp}) 与 AsType({tableTypeDisplayCsharp}) 不一致,请检查。 + The data type of the operation ({dataDisplayCsharp}) is inconsistent with AsType ({tableTypeDisplayCsharp}). Please check. - DateRange 要求 Value 应该逗号分割,并且长度为 2 + DateRange requires that Value be comma-separated and 2-length - DateRange 要求 Value[1] 格式必须为:yyyy、yyyy-MM、yyyy-MM-dd、yyyy-MM-dd HH、yyyy、yyyy-MM-dd HH:mm + DateRange requires that the Value [1] format must be: yyyy, yyyy-MM, yyyy-MM-dd, yyyyy-MM-dd HH, yyyy, yyyy-MM-dd HH:mm - 记录可能不存在,或者【行级乐观锁】版本过旧,更新数量{sourceCount},影响的行数{affrows}。 + The record may not exist, or the row level optimistic lock version is out of date, the number of updates {sourceCount}, the number of rows affected {affrows}. - SlaveConnectionString 数量与 SlaveWeights 不相同 + The number of SlaveConnectionStrings is not the same as SlaveWeights - ColumnAttribute.Name {colattrName} 重复存在,请检查(注意:不区分大小写) + ColumnAttribute. Name {colattrName} exists repeatedly, please check (note: case insensitive) - 属性名 {pName} 重复存在,请检查(注意:不区分大小写) + Property name {pName} exists repeatedly, please check (note: case insensitive) - {function} 功能要求实体类 {tableCsName} 必须有主键 + The {function} feature requires that the entity class {tableCsName} must have a primary key - {tbTypeFullName} 是父子关系,但是 MySql 8.0 以下版本中不支持组合多主键 + {tbTypeFullName} is a parent-child relationship, but combinations of multiple primary keys are not supported in versions below MySql 8.0 - {tbTypeFullName} 不是父子关系,无法使用该功能 + {tbTypeFullName} is not a parent-child relationship and cannot be used - 这个特别的子查询不能解析 + This particular subquery cannot be resolved - 表达式错误,它的顶级对象不是 ParameterExpression:{exp} + Expression error, its top object is not ParameterExpression:{exp} - 表达式错误,它不是连续的 MemberAccess 类型:{exp} + Expression error, it is not a continuous MemberAccess type: {exp} - ExpressionTree 转换类型错误,值({value}),类型({valueTypeFullName}),目标类型({typeFullName}),{exMessage} + ExpressionTree conversion type error, value ({value}), type ({valueTypeFullName}), target type ({typeFullName}), Error:{exMessage} - 未能解析分表字段值 {sqlWhere} + Failed to parse table field value {sqlWhere} - AsTable 未实现的功能 {asTable} + Function {asTable} not implemented by AsTable - GBase 暂时不支持逗号以外的分割符 + GBase does not support separators other than commas at this time - tableName:{tableName} 生成了相同的分表名 + TableName:{tableName} generated the same table name - GetPrimarys 传递的参数 "{primary}" 不正确,它不属于字典数据的键名 + The parameter'{primary}'passed by GetPrimarys is incorrect and does not belong to the key name of the dictionary data - 已经指定了 {first},不能再指定 {second} + {first} has already been specified and {second} can no longer be specified - {tb2DbName}.{mp2MemberName} 被忽略,请检查 IsIgnore 设置,确认 get/set 为 public + {tb2DbName}. {mp2MemberName} is ignored. Check the IsIgnore setting to make sure get/set is public - Include 参数类型错误 + Include parameter type error - Include 参数类型错误,集合属性请使用 IncludeMany + Include parameter type is wrong, use IncludeMany for collection properties - Include 参数类型错误,表达式类型应该为 MemberAccess + Include parameter type is wrong, expression type should be MemberAccess - IncludeMany 类型 {tbTypeDisplayCsharp} 的属性 {collMemMemberName} 不是有效的导航属性,提示:IsIgnore = true 不会成为导航属性 + The property {collMemMemberName} of IncludeMany type {tbTypeDisplayCsharp} is not a valid navigation property, hint: IsIgnore = true will not be a navigation property - IncludeMany {navigateSelector} 参数错误,Select 只可以使用一个参数的方法,正确格式:.Select(t =>new TNavigate {{}}) + IncludeMany {navigateSelector} parameter is wrong, Select can only use one parameter's method, the correct format:.Select(t =>new TNavigate{{}}) - IncludeMany {navigateSelector} 参数错误,Select lambda参数返回值必须和 {collMemElementType} 类型一致 + IncludeMany {navigateSelector} parameter error, Select lambda parameter return value must match {collMemElementType} type - IncludeMany 参数1 类型错误,表达式类型应该为 MemberAccess + IncludeMany parameter 1 has wrong type, expression type should be MemberAccess - IncludeMany {navigateSelector} 参数类型错误,正确格式: a.collections.Take(1).Where(c =>c.aid == a.id).Select(a=> new TNavigate{{}}) + IncludeMany {navigateSelector} parameter type is wrong, correct format: a.collections.Take(1).Where(c => C.A ID == a.id).Select (a => new TNavigate{{}}) - ISelect.InsertInto() 未选择属性: {displayCsharp} + ISelect. InsertInto() did not select an attribute: {displayCsharp} - ISelect.InsertInto() 类型错误: {displayCsharp} + ISelect. InsertInto() type error: {displayCsharp} - InsertOrUpdate 功能执行 merge into 要求实体类 {CsName} 必须有主键 + The InsertOrUpdate function performs merge into requiring the entity class {CsName} to have a primary key - InsertOrUpdate<>的泛型参数 不支持 {typeofT1},请传递您的实体类 + The generic parameter for InsertOrUpdate<>does not support {typeofT1}. Pass in your entity class - 【延时加载】功能需要安装 FreeSql.Extensions.LazyLoading.dll,可前往 nuget 下载 + FreeSql needs to be installed for Delayed Loading. Extensions. LazyLoading. Dll, downloadable to nuget - 【延时加载】{trytbTypeName} 编译错误:{exMessage}\r\n\r\n{cscode} + {trytbTypeName} Compilation error: {exMessage}\r\n\r\n{cscode} - 【延时加载】实体类型 {trytbTypeName} 必须声明为 public + Entity type {trytbTypeName} must be declared public - ManyToMany 导航属性 .AsSelect() 暂时不可用于 Sum/Avg/Max/Min/First/ToOne/ToList 方法 + ManyToMany navigation properties. AsSelect() is temporarily unavailable for the Sum/Avg/Max/Min/First/ToOne/ToList method - 【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 在 {tbmidCsName} 中没有找到对应的字段,如:{midTypePropsTrytbName}{findtrytbPkCsName}、{midTypePropsTrytbName}_{findtrytbPkCsName} + [ManyToMany] Navigation property {trytbTypeName}. {pnvName} did not find a corresponding field in {tbmidCsName}, such as: {midTypePropsTrytbName}{findtrytbPkCsName}, {midTypePropsTrytbName}_ {findtrytbPkCsName} - 【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,实体类型 {tbrefTypeName} 缺少主键标识,[Column(IsPrimary = true)] + [ManyToMany] Navigation property {trytbTypeName}. {pnvName} parsing error, entity type {tbrefTypeName} missing primary key identity, [Column (IsPrimary = true)] - 【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,实体类型 {tbrefTypeName} 必须存在对应的 [Navigate(ManyToMany = x)] 集合属性 + [ManyToMany] Navigation property {trytbTypeName}. {pnvName} parsing error, entity type {tbrefTypeName} must have a corresponding [Navigate (ManyToMany = x)] collection property - 【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,{tbmidCsName}.{trycolCsName} 和 {trytbCsName}.{trytbPrimarysCsName} 类型不一致 + [ManyToMany] Navigation property {trytbTypeName}. {pnvName} parsing error, {tbmidCsName}. {trycolCsName} and {trytbCsName}. {trytbPrimarysCsName} type inconsistent - 【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,中间类 {tbmidCsName}.{midTypePropsTrytbName} 错误:{exMessage} + [ManyToMany] Navigation property {trytbTypeName}. {pnvName} parsing error, intermediate class {tbmidCsName}.{midTypePropsTrytbName} Error: {exMessage} - 【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,中间类 {tbmidCsName}.{midTypePropsTrytbName} 导航属性不是【ManyToOne】或【OneToOne】 + [ManyToMany] Navigation property {trytbTypeName}. {pnvName} parsing error, intermediate class {tbmidCsName}. The {midTypePropsTrytbName} navigation property is not ManyToOne or OneToOne - 映射异常:{name} 没有一个属性名相同 + Mapping exception: {name} None of the property names are the same - Ado.MasterPool 值为 null,该操作无法自启用事务,请显式传递【事务对象】解决 + Ado. MasterPool value is null, this operation cannot self-enable transactions, please explicitly pass [transaction object] resolution - 缺少 FreeSql 数据库实现包:FreeSql.Provider.{Provider}.dll,可前往 nuget 下载 + Missing FreeSql database implementation package: FreeSql. Provider. {Provider}. Dll, downloadable to nuget - 缺少 FreeSql 数据库实现包:{dll},可前往 nuget 下载;如果存在 {dll} 依然报错(原因是环境问题导致反射不到类型),请在 UseConnectionString/UseConnectionFactory 第三个参数手工传入 typeof({providerType}) + The FreeSql database implementation package is missing: {dll} can be downloaded to nuget; If there is {dll} and an error still occurs (due to environmental issues that cause the type to be unreflected), manually pass in typeof ({providerType}) in the third parameter of UseConnectionString/UseConnectionFactory - 导航属性 {trytbTypeName}.{pnvName} 特性 [Navigate] Bind 数目({bindColumnsCount}) 与 外部主键数目({tbrefPrimarysLength}) 不相同 + Navigation property {trytbTypeName}. The number of {pnvName} attributes [Navigate] Binds ({bindColumnsCount}) is different from the number of external primary keys ({tbrefPrimarysLength}) - {tb2DbName}.{mp2MemberName} 导航属性集合忘了 .AsSelect() 吗?如果在 ToList(a => a.{mp2MemberName}) 中使用,请移步参考 IncludeMany 文档。 + {tb2DbName}. {mp2MemberName} Navigation Property Collection forgotten. AsSelect()? If used in ToList (a => a. {mp2MemberName}), step by step to refer to the IncludeMany document. - 【导航属性】{trytbTypeDisplayCsharp}.{pName} 缺少 set 属性 + [Navigation Properties]{trytbTypeDisplayCsharp}. Missing set attribute for {pName} - 导航属性 {trytbTypeName}.{pnvName} 没有找到对应的字段,如:{pnvName}{findtbrefPkCsName}、{pnvName}_{findtbrefPkCsName}。或者使用 [Navigate] 特性指定关系映射。 + Navigation property {trytbTypeName}. {pnvName} No corresponding fields were found, such as: {pnvName}{findtbrefPkCsName}, {pnvName}_ {findtbrefPkCsName}. Or use the [Navigate] attribute to specify the relationship mapping. - 导航属性 {trytbTypeName}.{pnvName} 解析错误,实体类型 {trytcTypeName} 缺少主键标识,[Column(IsPrimary = true)] + Navigation property {trytbTypeName}. {pnvName} parsing error, entity type {trytcTypeName} missing primary key identity, [Column (IsPrimary = true)] - 导航属性 {trytbTypeName}.{pnvName} 解析错误,{trytbCsName}.{trycolCsName} 和 {tbrefCsName}.{tbrefPrimarysCsName} 类型不一致 + Navigation property {trytbTypeName}. {pnvName} parsing error, {trytbCsName}. {trycolCsName} and {tbrefCsName}. {tbrefPrimarysCsName} type inconsistent - 导航属性 {trytbTypeName}.{pnvName} 特性 [Navigate] 解析错误,在 {tbrefTypeName} 未找到属性:{bi} + Navigation property {trytbTypeName}. {pnvName} attribute [Navigate] parsing error, property not found at {tbrefTypeName}: {bi} - {tableTypeDisplayCsharp} 没有定义主键,无法使用 SetSource,请尝试 SetDto + {tableTypeDisplayCsharp} has no primary key defined and cannot use SetSource. Try SetDto or SetSource to specify a temporary primary key - 没有定义属性 + No properties defined - 未实现 + Not implemented - 未实现函数表达式 {exp} 解析 + Function expression {exp} parsing not implemented - 未实现函数表达式 {exp} 解析,参数 {expArguments} 必须为常量 + Function expression {exp} parsing not implemented, parameter {expArguments} must be constant - 未实现函数表达式 {exp} 解析,如果正在操作导航属性集合,请使用 .AsSelect().{exp3MethodName}({exp3ArgumentsCount}) + Function expression {exp} parsing is not implemented. Use if you are working on a navigation property collection. AsSelect (). {exp3MethodName} ({exp3ArgumentsCount}) - 未实现 MemberAccess 下的 Constant + Constant under MemberAccess is not implemented - 未实现 {name} + {name} is not implemented - 不支持 + I won't support it - {dataType} 不支持 OrderByRandom 随机排序 + {dataType} does not support OrderByRandom sorting - {property} 不是有效的导航属性 + {property} is not a valid navigation property - {dbName} 找不到列 {memberName} + {dbName} Column {memberName} not found - 找不到 {CsName} 对应的列 + Cannot find the column corresponding to {CsName} - 找不到属性:{memberName} + Attribute not found: {memberName} - 找不到属性名 {proto} + Property name {proto} not found - Custom 找不到对应的{{ 反射信息 }}:{fiValueCustomArray} + Custom could not find the corresponding {{ reflection information }}:{fiValueCustomArray} - Custom 找不到对应的{{ 静态方法名 }}:{fiValueCustomArray} + Custom could not find the corresponding {{ static method name }}:{fiValueCustomArray} - [Table(AsTable = xx)] 设置的属性名 {atmGroupsValue} 不存在 + The property name {atmGroupsValue} set by [Table(AsTable = xx)] does not exist - 未指定 UseConnectionString 或者 UseConnectionFactory + No UseConnectionString or UseConnectionFactory specified - 【{policyName}】ObjectPool.{GetName}() timeout {totalSeconds} seconds, see: https://github.com/dotnetcore/FreeSql/discussions/1081 + [{policyName}] ObjectPool. {GetName}() timeout {totalSeconds} seconds, see: https://github.com/dotnetcore/FreeSql/discussions/1081 - 【{policyName}】ObjectPool.GetAsync() The queue is too long. Policy.AsyncGetCapacity = {asyncGetCapacity} + [{policyName}] ObjectPool. GetAsync() The queue is too long. Policy. AsyncGetCapacity = {asyncGetCapacity} - 【OneToMany】导航属性 {trytbTypeName}.{pnvName} 在 {tbrefCsName} 中没有找到对应的字段,如:{findtrytb}{findtrytbPkCsName}、{findtrytb}_{findtrytbPkCsName} + [OneToMany] Navigation property {trytbTypeName}.{pnvName} did not find a corresponding field in {tbrefCsName}, such as: {findtrytb}{findtrytbPkCsName}, {findtrytb}_{findtrytbPkCsName} - 【OneToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,{trytbCsName}.{trytbPrimarysCsName} 和 {tbrefCsName}.{trycolCsName} 类型不一致 + [OneToMany] Navigation property {trytbTypeName}.{pnvName} parsing error, {trytbCsName}.{trytbPrimarysCsName} and {tbrefCsName}.{trycolCsName} is of inconsistent type - 、{refpropName}{findtrytbPkCsName}、{refpropName}_{findtrytbPkCsName}。或者使用 [Navigate] 特性指定关系映射。 + , {refpropName}{findtrytbPkCsName}, {refpropName}_{findtrytbPkCsName}. Or use the [Navigate] attribute to specify the relationship mapping. - 参数 field 未指定 + Parameter field not specified - {property} 参数错误,它不是集合属性,必须为 IList<T> 或者 ICollection<T> + The {property} parameter is incorrect, it is not a collection property and must be IList<T>or ICollection<T> - {property} 参数错误,它不是有效的导航属性 + The {property} parameter is incorrect, it is not a valid navigation property - {where} 参数错误,{keyval} 不是有效的属性名,在实体类 {reftbTypeDisplayCsharp} 无法找到 + {where} parameter error, {keyval} is not a valid property name and cannot be found in entity class {reftbTypeDisplayCsharp} - {property} 参数错误,格式 "TopicId=Id,多组使用逗号连接" + {property} parameter error, format "TopicId=Id, multiple groups using comma connection" - 解析失败 {callExpMethodName} {message} + Parsing failed {callExpMethodName} {message} - 【{policyName}】The ObjectPool has been disposed, see: https://github.com/dotnetcore/FreeSql/discussions/1079 + [{policyName}] The ObjectPool has been disposed, see: https://github.com/dotnetcore/FreeSql/discussions/1079 - 【{policyName}】状态不可用,等待后台检查程序恢复方可使用。{UnavailableExceptionMessage} + The {policyName} status is unavailable and cannot be used until the background checker is restored. {UnavailableExceptionMessage} - 属性{trytbVersionColumnCsName} 被标注为行锁(乐观锁)(IsVersion),但其必须为数字类型 或者 byte[],并且不可为 Nullable + The property {trytbVersionColumnCsName} is labeled as a row lock (optimistic lock) (IsVersion), but it must be a numeric type or byte[], and it cannot be Nullable - properties 参数不能为空 + Properrties parameter cannot be empty - {property} 属性名无法找到 + {property} property name not found - Range 要求 Value 应该逗号分割,并且长度为 2 + Range requires that Value be comma-separated and 2-length - 回滚 + RollBack - 运行时错误,反射获取 IncludeMany 方法失败 + Runtime error, reflection failed to get IncludeMany method - {qoteSql} is NULL,除非设置特性 [Column(IsNullable = false)] + {qoteSql} is NULL unless the attribute [Column (IsNullable = false)] - 分表字段值 "{dt}" 不能小于 "{beginTime} " + Subtable field value'{dt}'cannot be less than'{beginTime}' - 分表字段值不能为 null + Subtable field value cannot be null - 分表字段值 "{columnValue}" 不能转化成 DateTime + The tabular field value'{columnValue}'cannot be converted to DateTime - 分表字段值 "{dt}" 未匹配到分表名 + Table field value'{dt}'does not match table name - T2 类型错误 + Type T2 Error - tableName 格式错误,示例:“log_{yyyyMMdd}” + TableName format error, example: "log_{yyyyMMdd}" - {Type}.AsType 参数错误,请传入正确的实体类型 + {Type}. AsType parameter error, please pass in the correct entity type - {thatFullName} 类型无法访问构造函数 + The {thatFullName} type cannot access the constructor - {name} 类型错误 + {name} type error - {Type}.AsType 参数不支持指定为 object + {Type}. AsType parameter does not support specifying as object - 类型 {typeofFullName} 错误,不能使用 IncludeMany + Type {typeofFullName} error, IncludeMany cannot be used - 无法解析表达式:{exp} + Unable to parse expression: {exp} - 无法解析表达式方法 {exp3tmpCallMethodName} + Unable to parse expression method {exp3tmpCallMethodName} - 请使用 fsql.InsertDict(dict) 方法插入字典数据 + Please use fsql. InsertDict (dict) method inserts dictionary data diff --git a/FreeSql/Properties/CoreStrings.Designer.cs b/FreeSql/Properties/CoreStrings.Designer.cs index 34208668..f5d53c6b 100644 --- a/FreeSql/Properties/CoreStrings.Designer.cs +++ b/FreeSql/Properties/CoreStrings.Designer.cs @@ -4,6 +4,7 @@ using System; using System.Reflection; using System.Resources; +using System.Globalization; using System.Threading; namespace FreeSql @@ -19,8 +20,25 @@ namespace FreeSql /// public static class CoreStrings { - private static readonly ResourceManager _resourceManager - = new ResourceManager("FreeSql.Properties.CoreStrings", typeof(CoreStrings).Assembly); + private static readonly ResourceManager _resourceManager = new ResourceManager("FreeSql.Properties.CoreStrings", typeof(CoreStrings).Assembly); + + private static CultureInfo _resourceCulture; + + /// + /// 重写当前线程的 CurrentUICulture 属性,对 + /// 使用此强类型资源类的所有资源查找执行重写。 + /// + public static CultureInfo Culture + { + get + { + return _resourceCulture; + } + set + { + _resourceCulture = value; + } + } /// /// [Table(AsTable = "{asTable}")] 特性值格式错误 @@ -565,7 +583,7 @@ namespace FreeSql trytbTypeName, pnvName, tbrefTypeName, bi); /// - /// {tableTypeDisplayCsharp} 没有定义主键,无法使用 SetSource,请尝试 SetDto + /// {tableTypeDisplayCsharp} 没有定义主键,无法使用 SetSource,请尝试 SetDto 或者 SetSource 指定临时主键 /// public static string NoPrimaryKey_UseSetDto(object tableTypeDisplayCsharp) => string.Format( @@ -964,7 +982,7 @@ namespace FreeSql private static string GetString(string name, params string[] formatterNames) { - var value = _resourceManager.GetString(name); + var value = _resourceManager.GetString(name,_resourceCulture); for (var i = 0; i < formatterNames.Length; i++) { value = value.Replace("{" + formatterNames[i] + "}", "{" + i + "}"); diff --git a/FreeSql/Properties/CoreStrings.en-US.resx b/FreeSql/Properties/CoreStrings.zh-Hans.resx similarity index 54% rename from FreeSql/Properties/CoreStrings.en-US.resx rename to FreeSql/Properties/CoreStrings.zh-Hans.resx index 29eae3a7..d7036cb3 100644 --- a/FreeSql/Properties/CoreStrings.en-US.resx +++ b/FreeSql/Properties/CoreStrings.zh-Hans.resx @@ -118,10 +118,10 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - [Table(AsTable="{asTable}")] Property value formatted incorrectly + [Table(AsTable = "{asTable}")] 特性值格式错误 - The property name {atmGroupsValue} set by [Table (AsTable = xx)] is not of type DateTime + [Table(AsTable = xx)] 设置的属性名 {atmGroupsValue} 不是 DateTime 类型 {name}: Failed to get resource {statistics} @@ -130,369 +130,369 @@ {name}: An exception needs to be thrown - Wrong expression format {column} + 错误的表达式格式 {column} - Select is not available until the Chunk function + Chunk 功能之前不可使用 Select - For security reasons, be sure to use ForUpdate after the transaction is open + 安全起见,请务必在事务开启之后,再使用 ForUpdate - Cannot be null + 不能为 null - {name} cannot be null + {name} 不能为 null - Unable to match {property} + 无法匹配 {property} - {property} cannot be resolved to an expression tree + {property} 无法解析为表达式树 - The parameter master ConnectionString cannot be empty, check UseConnectionString + 参数 masterConnectionString 不可为空,请检查 UseConnectionString - Commit + 提交 - Connection failed, ready to switch other available servers + 连接失败,准备切换其他可用服务器 - Custom expression parsing error: type {exp3MethodDeclaringType} needs to define static ThreadLocal<ExpressionCallContext>field, field, field (important three reminders) + 自定义表达式解析错误:类型 {exp3MethodDeclaringType} 需要定义 static ThreadLocal<ExpressionCallContext> 字段、字段、字段(重要三次提醒) - Custom {Reflection Information} cannot be empty, format: {static method name}{space}{reflection information} + Custom { 反射信息 }不能为空,格式:{ 静态方法名 }{ 空格 }{ 反射信息 } - Custom {static method name} cannot be empty, format: {static method name}{space}{reflection information} + Custom { 静态方法名 }不能为空,格式:{ 静态方法名 }{ 空格 }{ 反射信息 } - Custom corresponding {{static method name}}:{fiValueCustomArray} The [DynamicFilterCustomAttribute] attribute is not set + Custom 对应的{{ 静态方法名 }}:{fiValueCustomArray} 未设置 [DynamicFilterCustomAttribute] 特性 - Custom requires that Fields be space-split and 2-length in the format: {static method name}{space}{reflection information} + Custom 要求 Field 应该空格分割,并且长度为 2,格式:{ 静态方法名 }{ 空格 }{ 反射信息 } - The data type of the operation ({dataDisplayCsharp}) is inconsistent with AsType ({tableTypeDisplayCsharp}). Please check. + 操作的数据类型({dataDisplayCsharp}) 与 AsType({tableTypeDisplayCsharp}) 不一致,请检查。 - DateRange requires that Value be comma-separated and 2-length + DateRange 要求 Value 应该逗号分割,并且长度为 2 - DateRange requires that the Value [1] format must be: yyyy, yyyy-MM, yyyy-MM-dd, yyyyy-MM-dd HH, yyyy, yyyy-MM-dd HH:mm + DateRange 要求 Value[1] 格式必须为:yyyy、yyyy-MM、yyyy-MM-dd、yyyy-MM-dd HH、yyyy、yyyy-MM-dd HH:mm - The record may not exist, or the row level optimistic lock version is out of date, the number of updates {sourceCount}, the number of rows affected {affrows}. + 记录可能不存在,或者【行级乐观锁】版本过旧,更新数量{sourceCount},影响的行数{affrows}。 - The number of SlaveConnectionStrings is not the same as SlaveWeights + SlaveConnectionString 数量与 SlaveWeights 不相同 - ColumnAttribute. Name {colattrName} exists repeatedly, please check (note: case insensitive) + ColumnAttribute.Name {colattrName} 重复存在,请检查(注意:不区分大小写) - Property name {pName} exists repeatedly, please check (note: case insensitive) + 属性名 {pName} 重复存在,请检查(注意:不区分大小写) - The {function} feature requires that the entity class {tableCsName} must have a primary key + {function} 功能要求实体类 {tableCsName} 必须有主键 - {tbTypeFullName} is a parent-child relationship, but combinations of multiple primary keys are not supported in versions below MySql 8.0 + {tbTypeFullName} 是父子关系,但是 MySql 8.0 以下版本中不支持组合多主键 - {tbTypeFullName} is not a parent-child relationship and cannot be used + {tbTypeFullName} 不是父子关系,无法使用该功能 - This particular subquery cannot be resolved + 这个特别的子查询不能解析 - Expression error, its top object is not ParameterExpression:{exp} + 表达式错误,它的顶级对象不是 ParameterExpression:{exp} - Expression error, it is not a continuous MemberAccess type: {exp} + 表达式错误,它不是连续的 MemberAccess 类型:{exp} - ExpressionTree conversion type error, value ({value}), type ({valueTypeFullName}), target type ({typeFullName}), Error:{exMessage} + ExpressionTree 转换类型错误,值({value}),类型({valueTypeFullName}),目标类型({typeFullName}),{exMessage} - Failed to parse table field value {sqlWhere} + 未能解析分表字段值 {sqlWhere} - Function {asTable} not implemented by AsTable + AsTable 未实现的功能 {asTable} - GBase does not support separators other than commas at this time + GBase 暂时不支持逗号以外的分割符 - TableName:{tableName} generated the same table name + tableName:{tableName} 生成了相同的分表名 - The parameter'{primary}'passed by GetPrimarys is incorrect and does not belong to the key name of the dictionary data + GetPrimarys 传递的参数 "{primary}" 不正确,它不属于字典数据的键名 - {first} has already been specified and {second} can no longer be specified + 已经指定了 {first},不能再指定 {second} - {tb2DbName}. {mp2MemberName} is ignored. Check the IsIgnore setting to make sure get/set is public + {tb2DbName}.{mp2MemberName} 被忽略,请检查 IsIgnore 设置,确认 get/set 为 public - Include parameter type error + Include 参数类型错误 - Include parameter type is wrong, use IncludeMany for collection properties + Include 参数类型错误,集合属性请使用 IncludeMany - Include parameter type is wrong, expression type should be MemberAccess + Include 参数类型错误,表达式类型应该为 MemberAccess - The property {collMemMemberName} of IncludeMany type {tbTypeDisplayCsharp} is not a valid navigation property, hint: IsIgnore = true will not be a navigation property + IncludeMany 类型 {tbTypeDisplayCsharp} 的属性 {collMemMemberName} 不是有效的导航属性,提示:IsIgnore = true 不会成为导航属性 - IncludeMany {navigateSelector} parameter is wrong, Select can only use one parameter's method, the correct format:.Select(t =>new TNavigate{{}}) + IncludeMany {navigateSelector} 参数错误,Select 只可以使用一个参数的方法,正确格式:.Select(t =>new TNavigate {{}}) - IncludeMany {navigateSelector} parameter error, Select lambda parameter return value must match {collMemElementType} type + IncludeMany {navigateSelector} 参数错误,Select lambda参数返回值必须和 {collMemElementType} 类型一致 - IncludeMany parameter 1 has wrong type, expression type should be MemberAccess + IncludeMany 参数1 类型错误,表达式类型应该为 MemberAccess - IncludeMany {navigateSelector} parameter type is wrong, correct format: a.collections.Take(1).Where(c => C.A ID == a.id).Select (a => new TNavigate{{}}) + IncludeMany {navigateSelector} 参数类型错误,正确格式: a.collections.Take(1).Where(c =>c.aid == a.id).Select(a=> new TNavigate{{}}) - ISelect. InsertInto() did not select an attribute: {displayCsharp} + ISelect.InsertInto() 未选择属性: {displayCsharp} - ISelect. InsertInto() type error: {displayCsharp} + ISelect.InsertInto() 类型错误: {displayCsharp} - The InsertOrUpdate function performs merge into requiring the entity class {CsName} to have a primary key + InsertOrUpdate 功能执行 merge into 要求实体类 {CsName} 必须有主键 - The generic parameter for InsertOrUpdate<>does not support {typeofT1}. Pass in your entity class + InsertOrUpdate<>的泛型参数 不支持 {typeofT1},请传递您的实体类 - FreeSql needs to be installed for Delayed Loading. Extensions. LazyLoading. Dll, downloadable to nuget + 【延时加载】功能需要安装 FreeSql.Extensions.LazyLoading.dll,可前往 nuget 下载 - {trytbTypeName} Compilation error: {exMessage}\r\n\r\n{cscode} + 【延时加载】{trytbTypeName} 编译错误:{exMessage}\r\n\r\n{cscode} - Entity type {trytbTypeName} must be declared public + 【延时加载】实体类型 {trytbTypeName} 必须声明为 public - ManyToMany navigation properties. AsSelect() is temporarily unavailable for the Sum/Avg/Max/Min/First/ToOne/ToList method + ManyToMany 导航属性 .AsSelect() 暂时不可用于 Sum/Avg/Max/Min/First/ToOne/ToList 方法 - [ManyToMany] Navigation property {trytbTypeName}. {pnvName} did not find a corresponding field in {tbmidCsName}, such as: {midTypePropsTrytbName}{findtrytbPkCsName}, {midTypePropsTrytbName}_ {findtrytbPkCsName} + 【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 在 {tbmidCsName} 中没有找到对应的字段,如:{midTypePropsTrytbName}{findtrytbPkCsName}、{midTypePropsTrytbName}_{findtrytbPkCsName} - [ManyToMany] Navigation property {trytbTypeName}. {pnvName} parsing error, entity type {tbrefTypeName} missing primary key identity, [Column (IsPrimary = true)] + 【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,实体类型 {tbrefTypeName} 缺少主键标识,[Column(IsPrimary = true)] - [ManyToMany] Navigation property {trytbTypeName}. {pnvName} parsing error, entity type {tbrefTypeName} must have a corresponding [Navigate (ManyToMany = x)] collection property + 【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,实体类型 {tbrefTypeName} 必须存在对应的 [Navigate(ManyToMany = x)] 集合属性 - [ManyToMany] Navigation property {trytbTypeName}. {pnvName} parsing error, {tbmidCsName}. {trycolCsName} and {trytbCsName}. {trytbPrimarysCsName} type inconsistent + 【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,{tbmidCsName}.{trycolCsName} 和 {trytbCsName}.{trytbPrimarysCsName} 类型不一致 - [ManyToMany] Navigation property {trytbTypeName}. {pnvName} parsing error, intermediate class {tbmidCsName}.{midTypePropsTrytbName} Error: {exMessage} + 【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,中间类 {tbmidCsName}.{midTypePropsTrytbName} 错误:{exMessage} - [ManyToMany] Navigation property {trytbTypeName}. {pnvName} parsing error, intermediate class {tbmidCsName}. The {midTypePropsTrytbName} navigation property is not ManyToOne or OneToOne + 【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,中间类 {tbmidCsName}.{midTypePropsTrytbName} 导航属性不是【ManyToOne】或【OneToOne】 - Mapping exception: {name} None of the property names are the same + 映射异常:{name} 没有一个属性名相同 - Ado. MasterPool value is null, this operation cannot self-enable transactions, please explicitly pass [transaction object] resolution + Ado.MasterPool 值为 null,该操作无法自启用事务,请显式传递【事务对象】解决 - Missing FreeSql database implementation package: FreeSql. Provider. {Provider}. Dll, downloadable to nuget + 缺少 FreeSql 数据库实现包:FreeSql.Provider.{Provider}.dll,可前往 nuget 下载 - The FreeSql database implementation package is missing: {dll} can be downloaded to nuget; If there is {dll} and an error still occurs (due to environmental issues that cause the type to be unreflected), manually pass in typeof ({providerType}) in the third parameter of UseConnectionString/UseConnectionFactory + 缺少 FreeSql 数据库实现包:{dll},可前往 nuget 下载;如果存在 {dll} 依然报错(原因是环境问题导致反射不到类型),请在 UseConnectionString/UseConnectionFactory 第三个参数手工传入 typeof({providerType}) - Navigation property {trytbTypeName}. The number of {pnvName} attributes [Navigate] Binds ({bindColumnsCount}) is different from the number of external primary keys ({tbrefPrimarysLength}) + 导航属性 {trytbTypeName}.{pnvName} 特性 [Navigate] Bind 数目({bindColumnsCount}) 与 外部主键数目({tbrefPrimarysLength}) 不相同 - {tb2DbName}. {mp2MemberName} Navigation Property Collection forgotten. AsSelect()? If used in ToList (a => a. {mp2MemberName}), step by step to refer to the IncludeMany document. + {tb2DbName}.{mp2MemberName} 导航属性集合忘了 .AsSelect() 吗?如果在 ToList(a => a.{mp2MemberName}) 中使用,请移步参考 IncludeMany 文档。 - [Navigation Properties]{trytbTypeDisplayCsharp}. Missing set attribute for {pName} + 【导航属性】{trytbTypeDisplayCsharp}.{pName} 缺少 set 属性 - Navigation property {trytbTypeName}. {pnvName} No corresponding fields were found, such as: {pnvName}{findtbrefPkCsName}, {pnvName}_ {findtbrefPkCsName}. Or use the [Navigate] attribute to specify the relationship mapping. + 导航属性 {trytbTypeName}.{pnvName} 没有找到对应的字段,如:{pnvName}{findtbrefPkCsName}、{pnvName}_{findtbrefPkCsName}。或者使用 [Navigate] 特性指定关系映射。 - Navigation property {trytbTypeName}. {pnvName} parsing error, entity type {trytcTypeName} missing primary key identity, [Column (IsPrimary = true)] + 导航属性 {trytbTypeName}.{pnvName} 解析错误,实体类型 {trytcTypeName} 缺少主键标识,[Column(IsPrimary = true)] - Navigation property {trytbTypeName}. {pnvName} parsing error, {trytbCsName}. {trycolCsName} and {tbrefCsName}. {tbrefPrimarysCsName} type inconsistent + 导航属性 {trytbTypeName}.{pnvName} 解析错误,{trytbCsName}.{trycolCsName} 和 {tbrefCsName}.{tbrefPrimarysCsName} 类型不一致 - Navigation property {trytbTypeName}. {pnvName} attribute [Navigate] parsing error, property not found at {tbrefTypeName}: {bi} + 导航属性 {trytbTypeName}.{pnvName} 特性 [Navigate] 解析错误,在 {tbrefTypeName} 未找到属性:{bi} - {tableTypeDisplayCsharp} has no primary key defined and cannot use SetSource. Try SetDto or SetSource to specify a temporary primary key + {tableTypeDisplayCsharp} 没有定义主键,无法使用 SetSource,请尝试 SetDto 或者 SetSource 指定临时主键 - No properties defined + 没有定义属性 - Not implemented + 未实现 - Function expression {exp} parsing not implemented + 未实现函数表达式 {exp} 解析 - Function expression {exp} parsing not implemented, parameter {expArguments} must be constant + 未实现函数表达式 {exp} 解析,参数 {expArguments} 必须为常量 - Function expression {exp} parsing is not implemented. Use if you are working on a navigation property collection. AsSelect (). {exp3MethodName} ({exp3ArgumentsCount}) + 未实现函数表达式 {exp} 解析,如果正在操作导航属性集合,请使用 .AsSelect().{exp3MethodName}({exp3ArgumentsCount}) - Constant under MemberAccess is not implemented + 未实现 MemberAccess 下的 Constant - {name} is not implemented + 未实现 {name} - I won't support it + 不支持 - {dataType} does not support OrderByRandom sorting + {dataType} 不支持 OrderByRandom 随机排序 - {property} is not a valid navigation property + {property} 不是有效的导航属性 - {dbName} Column {memberName} not found + {dbName} 找不到列 {memberName} - Cannot find the column corresponding to {CsName} + 找不到 {CsName} 对应的列 - Attribute not found: {memberName} + 找不到属性:{memberName} - Property name {proto} not found + 找不到属性名 {proto} - Custom could not find the corresponding {{reflection information}}:{fiValueCustomArray} + Custom 找不到对应的{{ 反射信息 }}:{fiValueCustomArray} - Custom could not find the corresponding {{static method name}}:{fiValueCustomArray} + Custom 找不到对应的{{ 静态方法名 }}:{fiValueCustomArray} - The property name {atmGroupsValue} set by [Table(AsTable = xx)] does not exist + [Table(AsTable = xx)] 设置的属性名 {atmGroupsValue} 不存在 - No UseConnectionString or UseConnectionFactory specified + 未指定 UseConnectionString 或者 UseConnectionFactory - [{policyName}] ObjectPool. {GetName}() timeout {totalSeconds} seconds, see: https://github.com/dotnetcore/FreeSql/discussions/1081 + 【{policyName}】ObjectPool.{GetName}() timeout {totalSeconds} seconds, see: https://github.com/dotnetcore/FreeSql/discussions/1081 - [{policyName}] ObjectPool. GetAsync() The queue is too long. Policy. AsyncGetCapacity = {asyncGetCapacity} + 【{policyName}】ObjectPool.GetAsync() The queue is too long. Policy.AsyncGetCapacity = {asyncGetCapacity} - [OneToMany] Navigation property {trytbTypeName}.{pnvName} did not find a corresponding field in {tbrefCsName}, such as: {findtrytb}{findtrytbPkCsName}, {findtrytb}_{findtrytbPkCsName} + 【OneToMany】导航属性 {trytbTypeName}.{pnvName} 在 {tbrefCsName} 中没有找到对应的字段,如:{findtrytb}{findtrytbPkCsName}、{findtrytb}_{findtrytbPkCsName} - [OneToMany] Navigation property {trytbTypeName}.{pnvName} parsing error, {trytbCsName}.{trytbPrimarysCsName} and {tbrefCsName}.{trycolCsName} is of inconsistent type + 【OneToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,{trytbCsName}.{trytbPrimarysCsName} 和 {tbrefCsName}.{trycolCsName} 类型不一致 - , {refpropName}{findtrytbPkCsName}, {refpropName}_{findtrytbPkCsName}. Or use the [Navigate] attribute to specify the relationship mapping. + 、{refpropName}{findtrytbPkCsName}、{refpropName}_{findtrytbPkCsName}。或者使用 [Navigate] 特性指定关系映射。 - Parameter field not specified + 参数 field 未指定 - The {property} parameter is incorrect, it is not a collection property and must be IList<T>or ICollection<T> + {property} 参数错误,它不是集合属性,必须为 IList<T> 或者 ICollection<T> - The {property} parameter is incorrect, it is not a valid navigation property + {property} 参数错误,它不是有效的导航属性 - {where} parameter error, {keyval} is not a valid property name and cannot be found in entity class {reftbTypeDisplayCsharp} + {where} 参数错误,{keyval} 不是有效的属性名,在实体类 {reftbTypeDisplayCsharp} 无法找到 - {property} parameter error, format "TopicId=Id, multiple groups using comma connection" + {property} 参数错误,格式 "TopicId=Id,多组使用逗号连接" - Parsing failed {callExpMethodName} {message} + 解析失败 {callExpMethodName} {message} - [{policyName}] The ObjectPool has been disposed, see: https://github.com/dotnetcore/FreeSql/discussions/1079 + 【{policyName}】The ObjectPool has been disposed, see: https://github.com/dotnetcore/FreeSql/discussions/1079 - The {policyName} status is unavailable and cannot be used until the background checker is restored. {UnavailableExceptionMessage} + 【{policyName}】状态不可用,等待后台检查程序恢复方可使用。{UnavailableExceptionMessage} - The property {trytbVersionColumnCsName} is labeled as a row lock (optimistic lock) (IsVersion), but it must be a numeric type or byte[], and it cannot be Nullable + 属性{trytbVersionColumnCsName} 被标注为行锁(乐观锁)(IsVersion),但其必须为数字类型 或者 byte[],并且不可为 Nullable - Properrties parameter cannot be empty + properties 参数不能为空 - {property} property name not found + {property} 属性名无法找到 - Range requires that Value be comma-separated and 2-length + Range 要求 Value 应该逗号分割,并且长度为 2 - RollBack + 回滚 - Runtime error, reflection failed to get IncludeMany method + 运行时错误,反射获取 IncludeMany 方法失败 - {qoteSql} is NULL unless the attribute [Column (IsNullable = false)] + {qoteSql} is NULL,除非设置特性 [Column(IsNullable = false)] - Subtable field value'{dt}'cannot be less than'{beginTime}' + 分表字段值 "{dt}" 不能小于 "{beginTime} " - Subtable field value cannot be null + 分表字段值不能为 null - The tabular field value'{columnValue}'cannot be converted to DateTime + 分表字段值 "{columnValue}" 不能转化成 DateTime - Table field value'{dt}'does not match table name + 分表字段值 "{dt}" 未匹配到分表名 - Type T2 Error + T2 类型错误 - TableName format error, example: "log_{yyyyMMdd}" + tableName 格式错误,示例:“log_{yyyyMMdd}” - {Type}. AsType parameter error, please pass in the correct entity type + {Type}.AsType 参数错误,请传入正确的实体类型 - The {thatFullName} type cannot access the constructor + {thatFullName} 类型无法访问构造函数 - {name} type error + {name} 类型错误 - {Type}. AsType parameter does not support specifying as object + {Type}.AsType 参数不支持指定为 object - Type {typeofFullName} error, IncludeMany cannot be used + 类型 {typeofFullName} 错误,不能使用 IncludeMany - Unable to parse expression: {exp} + 无法解析表达式:{exp} - Unable to parse expression method {exp3tmpCallMethodName} + 无法解析表达式方法 {exp3tmpCallMethodName} - Please use fsql. InsertDict (dict) method inserts dictionary data + 请使用 fsql.InsertDict(dict) 方法插入字典数据 \ No newline at end of file diff --git a/FreeSql/Properties/Resources.tt b/FreeSql/Properties/Resources.tt index 104552ee..bbd73833 100644 --- a/FreeSql/Properties/Resources.tt +++ b/FreeSql/Properties/Resources.tt @@ -21,6 +21,7 @@ using System; using System.Reflection; using System.Resources; +using System.Globalization; <# if (!model.NoDiagnostics) { @@ -62,8 +63,25 @@ namespace <#= model.Namespace #> #> <#= model.AccessModifier #> static class <#= model.Class #> { - private static readonly ResourceManager _resourceManager - = new ResourceManager("<#= model.ResourceName #>", typeof(<#= model.Class #>).Assembly); + private static readonly ResourceManager _resourceManager = new ResourceManager("<#= model.ResourceName #>", typeof(<#= model.Class #>).Assembly); + + private static CultureInfo _resourceCulture; + + /// + /// 重写当前线程的 CurrentUICulture 属性,对 + /// 使用此强类型资源类的所有资源查找执行重写。 + /// + public static CultureInfo Culture + { + get + { + return _resourceCulture; + } + set + { + _resourceCulture = value; + } + } <# foreach (var resource in model.Resources) { @@ -108,7 +126,7 @@ namespace <#= model.Namespace #> private static string GetString(string name, params string[] formatterNames) { - var value = _resourceManager.GetString(name); + var value = _resourceManager.GetString(name,_resourceCulture); for (var i = 0; i < formatterNames.Length; i++) { value = value.Replace("{" + formatterNames[i] + "}", "{" + i + "}"); @@ -161,11 +179,10 @@ namespace <#= model.Namespace #> result.Class = Path.GetFileNameWithoutExtension(resourceFile); - result.ResourceName = resourceNamespace + "." + result.Class; - + List sortedResources; - using (var reader = new ResXResourceReader(resourceFile)) + using (var reader = new ResXResourceReader(resourceFile.Replace(".resx", ".zh-Hans.resx"))) { reader.UseResXDataNodes = true; sortedResources = Enumerable.ToList(