修改国际化

Uat_Study
hang 2023-06-28 10:03:29 +08:00
parent 808ade6e8d
commit c63251b832
2 changed files with 12 additions and 13 deletions

View File

@ -14,10 +14,10 @@ namespace IRaCIS.Core.Application.Helper
public static class InternationalizationHelper
{
public static void AddOrUpdateJsonKeyValueAsync(string jsonFileFolder,string key ,string value)
public static async void AddOrUpdateJsonKeyValueAsync(string key, string value)
{
var jsonFileFolder = Path.Combine(AppContext.BaseDirectory, StaticData.Folder.Resources);
if (!Directory.Exists(jsonFileFolder) ||
Directory.GetFiles(jsonFileFolder).Any(filePath => Path.GetExtension(filePath).Equals(".json", StringComparison.OrdinalIgnoreCase)))
@ -25,18 +25,19 @@ namespace IRaCIS.Core.Application.Helper
throw new BusinessValidationFailedException("国际化Json文件目录有误");
}
var json = File.ReadAllText("appsettings.json");
//
foreach (var filePath in Directory.GetFiles(jsonFileFolder).Where(filePath => Path.GetExtension(filePath).Equals(".json", StringComparison.OrdinalIgnoreCase)))
{
var json = await File.ReadAllTextAsync(filePath);
JObject jsonObject = JObject.Parse(json, new JsonLoadSettings() { CommentHandling = CommentHandling.Load });
// 添加或更新指定的键值对
jsonObject[key] = value;
//jsonObject["testArray"] = JArray.FromObject(generalRules);
await File.WriteAllTextAsync(filePath, jsonObject.ToString());
// 将更改保存回 Json 文件
//File.WriteAllText(jsonFilePath, jsonObject.ToString());
}
}
}

View File

@ -155,8 +155,6 @@ namespace IRaCIS.Application.Services
await _repository.BatchDeleteAsync<Attachment>(a => a.Id == updateGCPExperienceParam.GCPId);
}
return ResponseOutput.Result(successs, updateGCPExperienceParam.GCPId.ToString());
}