AbpDictionaryBasedStringLocalizer should use base cultures for getting all strings too.

pull/279/head
Halil İbrahim Kalkan 8 years ago
parent 4e1b9950fd
commit 6a782a6668

@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Globalization;
using System.Linq;
using Microsoft.Extensions.Localization;
namespace Volo.Abp.Localization
@ -125,9 +126,16 @@ namespace Volo.Abp.Localization
var dictionaries = Resource.DictionaryProvider.Dictionaries;
//Create a temp dictionary to build
var allStrings = new Dictionary<string, LocalizedString>();
foreach (var baseLocalizer in BaseLocalizers.Select(l => l.WithCulture(CultureInfo.GetCultureInfo(cultureName))))
{
foreach (var localizedString in baseLocalizer.GetAllStrings(includeParentCultures))
{
allStrings[localizedString.Name] = localizedString;
}
}
if (includeParentCultures)
{
//Fill all strings from default dictionary

@ -75,6 +75,8 @@ namespace Volo.Abp.Localization
{
_localizer["USA"].Value.ShouldBe("United States of America"); //Inherited from CountryNames/en.json
_localizer["ThisFieldIsRequired"].Value.ShouldBe("This field is required"); //Inherited from Validation/en.json
_localizer.GetAllStrings().ShouldContain(ls => ls.Name == "USA");
}
using (AbpCultureHelper.Use("tr"))

Loading…
Cancel
Save