修改国际化
parent
808ade6e8d
commit
c63251b832
|
@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -155,8 +155,6 @@ namespace IRaCIS.Application.Services
|
|||
await _repository.BatchDeleteAsync<Attachment>(a => a.Id == updateGCPExperienceParam.GCPId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
return ResponseOutput.Result(successs, updateGCPExperienceParam.GCPId.ToString());
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue