From fa5200f3fe2aeb102ef4a3567b9b4cd6755f27fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Sat, 21 Nov 2020 17:50:15 +0300 Subject: [PATCH] #6293 Fix AbpBlazorMessageLocalizerHelper --- .../AbpBlazorMessageLocalizerHelper.cs | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/AbpBlazorMessageLocalizerHelper.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/AbpBlazorMessageLocalizerHelper.cs index ff740be2e4..2a6fb19a11 100644 --- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/AbpBlazorMessageLocalizerHelper.cs +++ b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/AbpBlazorMessageLocalizerHelper.cs @@ -33,19 +33,15 @@ namespace Volo.Abp.AspNetCore.Components.WebAssembly foreach (var argument in arguments) { // first try to localize with "DisplayName:{Name}" - string localization = stringLocalizer[$"DisplayName:{argument}"]; + var localization = stringLocalizer[$"DisplayName:{argument}"]; - if (!string.IsNullOrEmpty(localization) && !localization.StartsWith("DisplayName:")) - yield return localization; + if (localization.ResourceNotFound) + { + // then try to localize with just "{Name}" + localization = stringLocalizer[argument]; + } - // then try to localize with just "{Name}" - localization = stringLocalizer[argument]; - - if (!string.IsNullOrEmpty(localization) && localization != argument) - yield return localization; - - // no localization found so just return what we got - yield return argument; + yield return localization; } } }