Initial commit - MassTech UI
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.JSInterop;
|
||||
using SoloX.BlazorJsonLocalization;
|
||||
|
||||
namespace UI.Config.Register
|
||||
{
|
||||
public class LocalizationHttpClient : HttpClient { }
|
||||
|
||||
public static class LocalizationSetup
|
||||
{
|
||||
public static IServiceCollection RegLocalization(
|
||||
this IServiceCollection services,
|
||||
string address
|
||||
)
|
||||
{
|
||||
services.AddHttpClient<LocalizationHttpClient>(sp =>
|
||||
{
|
||||
sp.BaseAddress = new Uri(address);
|
||||
});
|
||||
services.AddJsonLocalization(builder =>
|
||||
{
|
||||
builder
|
||||
.UseHttpClientJson(options =>
|
||||
{
|
||||
|
||||
options.ResourcesPath = "resources";
|
||||
options.Assemblies = [typeof(LayoutLib.RCL.SharedRes).Assembly, typeof(Auth.RCL.SharedRes).Assembly, typeof(ECommerce.RCL.SharedRes).Assembly];
|
||||
options.HttpClientBuilder = sp => sp.GetRequiredService<IHttpClientFactory>().CreateClient(nameof(LocalizationHttpClient));
|
||||
|
||||
});
|
||||
}, ServiceLifetime.Singleton);
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user