28 lines
830 B
C#
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);
|
|
}
|
|
}
|
|
}
|