Files
Atomx/Atomx.Admin/Atomx.Admin.Client/Services/JsonStringLocalizerFactory.cs
2025-12-06 13:30:17 +08:00

28 lines
830 B
C#

using Microsoft.Extensions.Localization;
using System.Net.Http;
namespace Atomx.Admin.Client.Services
{
public class JsonStringLocalizerFactory : IStringLocalizerFactory
{
private readonly string _resourcesPath;
private readonly HttpClient _httpClient;
public JsonStringLocalizerFactory(string resourcesPath, HttpClient httpClient)
{
_resourcesPath = (resourcesPath ?? "Localization").Trim('/');
_httpClient = httpClient;
}
public IStringLocalizer Create(Type resourceSource)
{
return new JsonStringLocalizer(_resourcesPath, _httpClient);
}
public IStringLocalizer Create(string baseName, string location)
{
return new JsonStringLocalizer(_resourcesPath, _httpClient);
}
}
}