Files
mixtape/zero.Core/Localization/ZeroLocalizationModule.cs
T

39 lines
1.4 KiB
C#
Raw Normal View History

2022-01-24 00:08:44 +01:00
using FluentValidation;
using Microsoft.Extensions.Configuration;
2021-11-30 14:32:10 +01:00
using Microsoft.Extensions.DependencyInjection;
2021-11-23 22:56:22 +01:00
namespace zero.Localization;
2022-01-06 18:10:58 +01:00
internal class ZeroLocalizationModule : ZeroModule
2021-11-23 22:56:22 +01:00
{
2021-11-30 14:32:10 +01:00
public override void ConfigureServices(IServiceCollection services, IConfiguration configuration)
2021-11-23 22:56:22 +01:00
{
services.AddScoped<ICultureResolver, CultureResolver>();
2021-11-24 13:56:08 +01:00
services.AddScoped<ICultureService, CultureService>();
2021-11-26 12:31:33 +01:00
services.AddScoped<ICountryStore, CountryStore>();
services.AddScoped<ILanguageStore, LanguageStore>();
services.AddScoped<ITranslationStore, TranslationStore>();
2021-11-23 22:56:22 +01:00
services.AddScoped<ILocalizer, Localizer>();
2022-01-24 00:08:44 +01:00
services.AddScoped<IValidator<Country>, CountryValidator>();
services.AddScoped<IValidator<Language>, LanguageValidator>();
services.AddScoped<IValidator<Translation>, TranslationValidator>();
2022-02-05 01:52:48 +01:00
services.Configure<ZeroSearchOptions>(opts =>
{
opts.Map<Country>("fth-map-pin").Fields().Display((x, res) =>
{
res.Url = "/settings/countries/edit/" + x.Id;
});
opts.Map<Language>("fth-globe").Fields().Display((x, res) =>
{
res.Url = "/settings/languages/edit/" + x.Id;
});
opts.Map<Translation>("fth-type").Fields("Value").Display((x, res) =>
{
res.Description = x.Value;
res.Url = "/settings/translations/edit/" + x.Id;
});
});
2021-11-23 22:56:22 +01:00
}
}