29 lines
1013 B
C#
29 lines
1013 B
C#
// using System.Text.Json;
|
|
// using System.Text.Json.Serialization;
|
|
// using NodePipeline.Abstractions;
|
|
//
|
|
// namespace NodePipeline.Application;
|
|
//
|
|
// [JsonSerializable(typeof(Dictionary<string, string>))]
|
|
// public partial class ValidationMessagesJsonContext : JsonSerializerContext
|
|
// {
|
|
// }
|
|
//
|
|
// public class JsonPipelineLocalizationProvider : PipelineLocalizationProvider
|
|
// {
|
|
// private readonly Dictionary<string, string> _messages;
|
|
//
|
|
// public JsonPipelineLocalizationProvider(string jsonFilePath)
|
|
// {
|
|
// var json = File.ReadAllText(jsonFilePath);
|
|
// //TODO: add context for Native AOC compatibility
|
|
// _messages = JsonSerializer.Deserialize<Dictionary<string, string>>(json, ValidationMessagesJsonContext.Default.DictionaryStringString) ?? [];
|
|
// }
|
|
//
|
|
// protected override string? TryGetMessage(string key, params object[] args)
|
|
// {
|
|
// return _messages.TryGetValue(key, out var template) ? string.Format(template, args) : null;
|
|
// }
|
|
// }
|
|
|