From 357179d4b7e1f92c46aed0275b56fee499b74df8 Mon Sep 17 00:00:00 2001 From: maliming Date: Fri, 13 Oct 2023 10:51:57 +0800 Subject: [PATCH] Update AbpBlazorMessageLocalizerHelper.cs --- .../Components/Web/AbpBlazorMessageLocalizerHelper.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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) {