Browse Source
Merge pull request #848 from colinin/fix-dynamic-localization
fix(localization): filter duplicate resources
pull/849/head
yx lin
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
2 additions and
0 deletions
-
aspnet-core/modules/localization/LINGYUN.Abp.AspNetCore.Mvc.Localization/LINGYUN/Abp/AspNetCore/Mvc/Localization/TextAppService.cs
|
|
|
@ -55,6 +55,7 @@ namespace LINGYUN.Abp.AspNetCore.Mvc.Localization |
|
|
|
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); |
|
|
|
|
|
|
|
@ -69,6 +70,7 @@ namespace LINGYUN.Abp.AspNetCore.Mvc.Localization |
|
|
|
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(); |
|
|
|
|