mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-11-07 18:04:55 +08:00
Support language type
This commit is contained in:
@@ -30,6 +30,10 @@ namespace SqlSugar
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public InitKeyType InitKeyType = InitKeyType.Attribute;
|
public InitKeyType InitKeyType = InitKeyType.Attribute;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// Exception prompt language
|
||||||
|
/// </summary>
|
||||||
|
public SugarLanguageType LanguageType { get=>ErrorMessage.SugarLanguageType; set=>ErrorMessage.SugarLanguageType=value; }
|
||||||
|
/// <summary>
|
||||||
///If true, there is only one connection instance in the same thread within the same connection string
|
///If true, there is only one connection instance in the same thread within the same connection string
|
||||||
//[Obsolete("use SqlSugar.Ioc")]
|
//[Obsolete("use SqlSugar.Ioc")]
|
||||||
///// </summary>
|
///// </summary>
|
||||||
|
|||||||
15
Src/Asp.Net/SqlSugar/Enum/LanguageType.cs
Normal file
15
Src/Asp.Net/SqlSugar/Enum/LanguageType.cs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SqlSugar
|
||||||
|
{
|
||||||
|
public enum SugarLanguageType
|
||||||
|
{
|
||||||
|
Default=0,
|
||||||
|
Chinese=1,
|
||||||
|
English=2
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -91,6 +91,7 @@
|
|||||||
<Compile Include="Abstract\DeleteProvider\DeleteableProvider.cs" />
|
<Compile Include="Abstract\DeleteProvider\DeleteableProvider.cs" />
|
||||||
<Compile Include="Abstract\InsertableProvider\SplitInsertable.cs" />
|
<Compile Include="Abstract\InsertableProvider\SplitInsertable.cs" />
|
||||||
<Compile Include="Entities\SqlSguarTransaction.cs" />
|
<Compile Include="Entities\SqlSguarTransaction.cs" />
|
||||||
|
<Compile Include="Enum\LanguageType.cs" />
|
||||||
<Compile Include="ExpressionsToSql\Subquery\Items\SubAs.cs" />
|
<Compile Include="ExpressionsToSql\Subquery\Items\SubAs.cs" />
|
||||||
<Compile Include="ExpressionsToSql\Subquery\Items\SubHaving.cs" />
|
<Compile Include="ExpressionsToSql\Subquery\Items\SubHaving.cs" />
|
||||||
<Compile Include="Interface\ISugarRepository.cs" />
|
<Compile Include="Interface\ISugarRepository.cs" />
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
internal static partial class ErrorMessage
|
internal static partial class ErrorMessage
|
||||||
{
|
{
|
||||||
|
internal static SugarLanguageType SugarLanguageType { get; set; } = SugarLanguageType.Default;
|
||||||
internal static string ObjNotExist
|
internal static string ObjNotExist
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -43,10 +44,21 @@ namespace SqlSugar
|
|||||||
|
|
||||||
internal static string GetThrowMessage(string enMessage, string cnMessage, params string[] args)
|
internal static string GetThrowMessage(string enMessage, string cnMessage, params string[] args)
|
||||||
{
|
{
|
||||||
List<string> formatArgs = new List<string>() { enMessage, cnMessage };
|
if (SugarLanguageType == SugarLanguageType.Default)
|
||||||
formatArgs.AddRange(args);
|
{
|
||||||
return string.Format(@"中文提示 : {1}
|
List<string> formatArgs = new List<string>() { enMessage, cnMessage };
|
||||||
|
formatArgs.AddRange(args);
|
||||||
|
return string.Format(@"中文提示 : {1}
|
||||||
English Message : {0}", formatArgs.ToArray());
|
English Message : {0}", formatArgs.ToArray());
|
||||||
|
}
|
||||||
|
else if (SugarLanguageType == SugarLanguageType.English)
|
||||||
|
{
|
||||||
|
return enMessage;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return cnMessage;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user