Update AbpBlazorMessageLocalizerHelper.cs

pull/17865/head
maliming 1 year ago
parent d7c3e5c6c6
commit 357179d4b7
No known key found for this signature in database
GPG Key ID: A646B9CB645ECEA4

@ -14,12 +14,13 @@ public class AbpBlazorMessageLocalizerHelper<T>
this.stringLocalizer = stringLocalizer;
}
public string Localize(string message, IEnumerable<string>? arguments)
public string Localize(string message, IEnumerable<string>? 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<T>
}
}
private IEnumerable<string> LocalizeMessageArguments(IEnumerable<string> arguments)
private IEnumerable<string> LocalizeMessageArguments(List<string> arguments)
{
foreach (var argument in arguments)
{

Loading…
Cancel
Save