Skip to content

Commit

Permalink
Merge pull request #848 from colinin/fix-dynamic-localization
Browse files Browse the repository at this point in the history
fix(localization): filter duplicate resources
  • Loading branch information
colinin authored Jul 12, 2023
2 parents c7c0b90 + e86be31 commit d1367c2
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public async virtual Task<ListResultDto<TextDifferenceDto>> GetListAsync(GetText
var filterResources = _localizationOptions.Resources
.Select(r => r.Value)
.Union(await _externalLocalizationStore.GetResourcesAsync())
.DistinctBy(r => r.ResourceName)
.WhereIf(!input.Filter.IsNullOrWhiteSpace(), x => x.ResourceName.Contains(input.Filter))
.OrderBy(r => r.ResourceName);

Expand All @@ -69,6 +70,7 @@ public async virtual Task<ListResultDto<TextDifferenceDto>> GetListAsync(GetText
var resource = _localizationOptions.Resources
.Select(r => r.Value)
.Union(await _externalLocalizationStore.GetResourcesAsync())
.DistinctBy(r => r.ResourceName)
.Where(l => l.ResourceName.Equals(input.ResourceName))
.WhereIf(!input.Filter.IsNullOrWhiteSpace(), x => x.ResourceName.Contains(input.Filter))
.FirstOrDefault();
Expand Down

0 comments on commit d1367c2

Please sign in to comment.