diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/UiNotificationOptions.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/UiNotificationOptions.cs index 2d51716cd9..ae8a400368 100644 --- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/UiNotificationOptions.cs +++ b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/UiNotificationOptions.cs @@ -1,4 +1,6 @@ -namespace Volo.Abp.AspNetCore.Components.WebAssembly +using Volo.Abp.Localization; + +namespace Volo.Abp.AspNetCore.Components.WebAssembly { /// /// Options to override notification appearance. @@ -8,7 +10,7 @@ /// /// Custom text for the Ok button. /// - public string OkButtonText { get; set; } + public ILocalizableString OkButtonText { get; set; } /// /// Custom icon for the Ok button. diff --git a/framework/src/Volo.Abp.BlazoriseUI/BlazoriseUiNotificationService.cs b/framework/src/Volo.Abp.BlazoriseUI/BlazoriseUiNotificationService.cs index be2d5c9d51..05c1cd5163 100644 --- a/framework/src/Volo.Abp.BlazoriseUI/BlazoriseUiNotificationService.cs +++ b/framework/src/Volo.Abp.BlazoriseUI/BlazoriseUiNotificationService.cs @@ -67,7 +67,6 @@ namespace Volo.Abp.BlazoriseUI { return new UiNotificationOptions { - OkButtonText = localizer["Ok"], }; } } diff --git a/framework/src/Volo.Abp.BlazoriseUI/Components/UiNotificationAlert.razor.cs b/framework/src/Volo.Abp.BlazoriseUI/Components/UiNotificationAlert.razor.cs index 691b6a7a1a..67c890f922 100644 --- a/framework/src/Volo.Abp.BlazoriseUI/Components/UiNotificationAlert.razor.cs +++ b/framework/src/Volo.Abp.BlazoriseUI/Components/UiNotificationAlert.razor.cs @@ -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()