修改国际化异常

IRC_NewDev
hang 2024-10-17 10:03:47 +08:00
parent 41e8164c2e
commit 8a3eb61a34
3 changed files with 18 additions and 12 deletions

View File

@ -248,14 +248,16 @@ app.MapMasaMinimalAPIs();
// Serilog
SerilogExtension.AddSerilogSetup(enviromentName, app.Services);
var hangfireJobService = app.Services.GetRequiredService<IIRaCISHangfireJob>();
await hangfireJobService.InitHangfireJobTaskAsync();
//设置国际化I18n
var localizer = app.Services.GetRequiredService<IStringLocalizer>();
I18n.SetLocalizer(localizer);
var hangfireJobService = app.Services.GetRequiredService<IIRaCISHangfireJob>();
await hangfireJobService.InitHangfireJobTaskAsync();
try
{
#region 运行环境 部署平台

View File

@ -27,15 +27,15 @@ public static class InternationalizationHelper
public static string USJsonPath = Path.Combine(JsonFileFolder, StaticData.En_US_Json);
public static string CNJsonPath = Path.Combine(JsonFileFolder, StaticData.Zh_CN_Json);
//static InternationalizationHelper()
//{
// if (!Directory.Exists(JsonFileFolder) ||
// !Directory.GetFiles(JsonFileFolder).Any(filePath => Path.GetExtension(filePath).Equals(".json", StringComparison.OrdinalIgnoreCase))||
// !File.Exists(USJsonPath) || !File.Exists(CNJsonPath))
// {
// throw new BusinessValidationFailedException(I18n.T("IRaCISCHangfireJob_FileNotFound"));
// }
//}
static InternationalizationHelper()
{
if (!Directory.Exists(JsonFileFolder) ||
!Directory.GetFiles(JsonFileFolder).Any(filePath => Path.GetExtension(filePath).Equals(".json", StringComparison.OrdinalIgnoreCase)) ||
!File.Exists(USJsonPath) || !File.Exists(CNJsonPath))
{
throw new BusinessValidationFailedException(I18n.T("IRaCISCHangfireJob_FileNotFound"));
}
}

View File

@ -27,6 +27,7 @@
<ItemGroup>
<None Remove="IRaCIS.Core.Application.xml" />
<None Remove="Resources\en-US.json" />
<None Remove="Resources\zh-CN.json" />
<None Remove="Resources\zh_ch.json" />
<None Remove="Service\Allocation\TaskConsistentRuleService.cs~RF1603d47.TMP" />
<None Remove="Service\Reading\ReadingImageTask\ReadingImageTaskService.cs~RF2f9323.TMP" />
@ -40,6 +41,9 @@
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
<Content Include="Resources\zh-CN.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>