Browse Source
Update AbpBlazorMessageLocalizerHelper.cs
pull/17865/head
maliming
3 years ago
No known key found for this signature in database
GPG Key ID: A646B9CB645ECEA4
1 changed files with
5 additions and
4 deletions
-
framework/src/Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web/AbpBlazorMessageLocalizerHelper.cs
|
|
|
@ -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) |
|
|
|
{ |
|
|
|
|