修改国际化
parent
808ade6e8d
commit
c63251b832
|
@ -14,29 +14,30 @@ namespace IRaCIS.Core.Application.Helper
|
||||||
public static class InternationalizationHelper
|
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) ||
|
||||||
if (!Directory.Exists(jsonFileFolder) ||
|
|
||||||
Directory.GetFiles(jsonFileFolder).Any(filePath => Path.GetExtension(filePath).Equals(".json", StringComparison.OrdinalIgnoreCase)))
|
Directory.GetFiles(jsonFileFolder).Any(filePath => Path.GetExtension(filePath).Equals(".json", StringComparison.OrdinalIgnoreCase)))
|
||||||
{
|
{
|
||||||
throw new BusinessValidationFailedException("国际化Json文件目录有误");
|
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 });
|
JObject jsonObject = JObject.Parse(json, new JsonLoadSettings() { CommentHandling = CommentHandling.Load });
|
||||||
|
|
||||||
|
// 添加或更新指定的键值对
|
||||||
|
jsonObject[key] = value;
|
||||||
|
|
||||||
// 添加或更新指定的键值对
|
await File.WriteAllTextAsync(filePath, jsonObject.ToString());
|
||||||
jsonObject[key] = value;
|
|
||||||
|
|
||||||
//jsonObject["testArray"] = JArray.FromObject(generalRules);
|
}
|
||||||
|
|
||||||
// 将更改保存回 Json 文件
|
|
||||||
//File.WriteAllText(jsonFilePath, jsonObject.ToString());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,8 +155,6 @@ namespace IRaCIS.Application.Services
|
||||||
await _repository.BatchDeleteAsync<Attachment>(a => a.Id == updateGCPExperienceParam.GCPId);
|
await _repository.BatchDeleteAsync<Attachment>(a => a.Id == updateGCPExperienceParam.GCPId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return ResponseOutput.Result(successs, updateGCPExperienceParam.GCPId.ToString());
|
return ResponseOutput.Result(successs, updateGCPExperienceParam.GCPId.ToString());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue