diff --git a/framework/src/Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web/AbpBlazorMessageLocalizerHelper.cs b/framework/src/Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web/AbpBlazorMessageLocalizerHelper.cs index dc0a2182cb..16a0c26e6b 100644 --- a/framework/src/Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web/AbpBlazorMessageLocalizerHelper.cs +++ b/framework/src/Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web/AbpBlazorMessageLocalizerHelper.cs @@ -14,12 +14,13 @@ public class AbpBlazorMessageLocalizerHelper this.stringLocalizer = stringLocalizer; } - public string Localize(string message, IEnumerable? arguments) + public string Localize(string message, IEnumerable? arguments = null) { try { - return arguments?.Count() > 0 - ? stringLocalizer[message, LocalizeMessageArguments(arguments)?.ToArray()!] + var argumentsList = arguments?.ToList(); + return argumentsList?.Count > 0 + ? stringLocalizer[message, LocalizeMessageArguments(argumentsList)] : stringLocalizer[message]; } catch @@ -28,7 +29,7 @@ public class AbpBlazorMessageLocalizerHelper } } - private IEnumerable LocalizeMessageArguments(IEnumerable arguments) + private IEnumerable LocalizeMessageArguments(List arguments) { foreach (var argument in arguments) {