new localizer works
This commit is contained in:
@@ -20,8 +20,7 @@ public class ConfigurationLocalizer : Localizer
|
||||
|
||||
protected override Translation LoadTranslation(string key)
|
||||
{
|
||||
string normalizedKey = key.Replace(".", ":");
|
||||
IConfigurationSection section = _configuration.GetSection($"Zero:Localization:{normalizedKey}");
|
||||
IConfigurationSection section = _configuration.GetSection($"Zero:Localization:{key}");
|
||||
|
||||
if (section == null)
|
||||
{
|
||||
|
||||
@@ -3,6 +3,14 @@ using Microsoft.Extensions.Localization;
|
||||
|
||||
namespace zero.Localization;
|
||||
|
||||
public class StringLocalizer<T> : StringLocalizer, IStringLocalizer<T>
|
||||
{
|
||||
public StringLocalizer(ILocalizer localizer) : base(localizer)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class StringLocalizer : IStringLocalizer
|
||||
{
|
||||
private readonly ILocalizer _localizer;
|
||||
|
||||
@@ -20,6 +20,7 @@ internal class ZeroLocalizationModule : ZeroModule
|
||||
services.AddScoped<ICultureService, CultureService>();
|
||||
services.AddScoped<ILocalizer, ConfigurationLocalizer>();
|
||||
services.AddScoped<IStringLocalizer, StringLocalizer>();
|
||||
services.AddScoped(typeof(IStringLocalizer<>), typeof(StringLocalizer<>));
|
||||
|
||||
services.Configure<RazorViewEngineOptions>(opts => opts.ViewLocationExpanders.Add(new LanguageViewLocationExpander(LanguageViewLocationExpanderFormat.Suffix)));
|
||||
services.AddSingleton<IHtmlLocalizerFactory, HtmlLocalizerFactory>();
|
||||
|
||||
Reference in New Issue
Block a user