OkButtonText converted to ILocalizableString

pull/5973/head
Mladen Macanovic 5 years ago
parent b3d2be5bfe
commit 947e06aaea

@ -1,4 +1,6 @@
namespace Volo.Abp.AspNetCore.Components.WebAssembly
using Volo.Abp.Localization;
namespace Volo.Abp.AspNetCore.Components.WebAssembly
{
/// <summary>
/// Options to override notification appearance.
@ -8,7 +10,7 @@
/// <summary>
/// Custom text for the Ok button.
/// </summary>
public string OkButtonText { get; set; }
public ILocalizableString OkButtonText { get; set; }
/// <summary>
/// Custom icon for the Ok button.

@ -67,7 +67,6 @@ namespace Volo.Abp.BlazoriseUI
{
return new UiNotificationOptions
{
OkButtonText = localizer["Ok"],
};
}
}

@ -2,6 +2,7 @@
using System.Threading.Tasks;
using Blazorise.Snackbar;
using Microsoft.AspNetCore.Components;
using Microsoft.Extensions.Localization;
using Volo.Abp.AspNetCore.Components.WebAssembly;
namespace Volo.Abp.BlazoriseUI.Components
@ -24,6 +25,8 @@ namespace Volo.Abp.BlazoriseUI.Components
[Inject] protected BlazoriseUiNotificationService UiNotificationService { get; set; }
[Inject] protected IStringLocalizerFactory StringLocalizerFactory { get; set; }
protected virtual SnackbarColor GetSnackbarColor(UiNotificationType notificationType)
{
return notificationType switch
@ -50,7 +53,9 @@ namespace Volo.Abp.BlazoriseUI.Components
Title = e.Title;
Options = e.Options;
SnackbarStack.Push(Message, GetSnackbarColor(e.NotificationType));
var okButtonText = Options?.OkButtonText?.Localize(StringLocalizerFactory);
SnackbarStack.Push(Message, GetSnackbarColor( e.NotificationType ), okButtonText);
}
public virtual void Dispose()

Loading…
Cancel
Save