forked from abpframework/abp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into integration-services
- Loading branch information
Showing
91 changed files
with
2,036 additions
and
382 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
...etCore.Mvc.Client.Common/ClientProxies/AbpApplicationLocalizationClientProxy.Generated.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// This file is automatically generated by ABP framework to use MVC Controllers from CSharp | ||
using System; | ||
using System.Threading.Tasks; | ||
using Volo.Abp.Application.Dtos; | ||
using Volo.Abp.Http.Client; | ||
using Volo.Abp.Http.Modeling; | ||
using Volo.Abp.DependencyInjection; | ||
using Volo.Abp.Http.Client.ClientProxying; | ||
using Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations; | ||
|
||
// ReSharper disable once CheckNamespace | ||
namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ClientProxies; | ||
|
||
[Dependency(ReplaceServices = true)] | ||
[ExposeServices(typeof(IAbpApplicationLocalizationAppService), typeof(AbpApplicationLocalizationClientProxy))] | ||
public partial class AbpApplicationLocalizationClientProxy : ClientProxyBase<IAbpApplicationLocalizationAppService>, IAbpApplicationLocalizationAppService | ||
{ | ||
public virtual async Task<ApplicationLocalizationDto> GetAsync(ApplicationLocalizationRequestDto input) | ||
{ | ||
return await RequestAsync<ApplicationLocalizationDto>(nameof(GetAsync), new ClientProxyRequestTypeValue | ||
{ | ||
{ typeof(ApplicationLocalizationRequestDto), input } | ||
}); | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
...o.Abp.AspNetCore.Mvc.Client.Common/ClientProxies/AbpApplicationLocalizationClientProxy.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// This file is part of AbpApplicationLocalizationClientProxy, you can customize it here | ||
// ReSharper disable once CheckNamespace | ||
namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ClientProxies; | ||
|
||
public partial class AbpApplicationLocalizationClientProxy | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 87 additions & 0 deletions
87
...tCore.Mvc.Client.Common/Volo/Abp/AspNetCore/Mvc/Client/RemoteExternalLocalizationStore.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using Microsoft.Extensions.Options; | ||
using Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations; | ||
using Volo.Abp.DependencyInjection; | ||
using Volo.Abp.Localization; | ||
using Volo.Abp.Localization.External; | ||
|
||
namespace Volo.Abp.AspNetCore.Mvc.Client; | ||
|
||
public class RemoteExternalLocalizationStore : IExternalLocalizationStore, ITransientDependency | ||
{ | ||
protected ICachedApplicationConfigurationClient ConfigurationClient { get; } | ||
protected AbpLocalizationOptions LocalizationOptions { get; } | ||
|
||
public RemoteExternalLocalizationStore( | ||
ICachedApplicationConfigurationClient configurationClient, | ||
IOptions<AbpLocalizationOptions> localizationOptions) | ||
{ | ||
ConfigurationClient = configurationClient; | ||
LocalizationOptions = localizationOptions.Value; | ||
} | ||
|
||
public virtual LocalizationResourceBase GetResourceOrNull(string resourceName) | ||
{ | ||
var configurationDto = ConfigurationClient.Get(); | ||
return CreateLocalizationResourceFromConfigurationOrNull(resourceName, configurationDto); | ||
} | ||
|
||
public virtual async Task<LocalizationResourceBase> GetResourceOrNullAsync(string resourceName) | ||
{ | ||
var configurationDto = await ConfigurationClient.GetAsync(); | ||
return CreateLocalizationResourceFromConfigurationOrNull(resourceName, configurationDto); | ||
} | ||
|
||
public virtual async Task<string[]> GetResourceNamesAsync() | ||
{ | ||
var configurationDto = await ConfigurationClient.GetAsync(); | ||
return configurationDto | ||
.Localization | ||
.Resources | ||
.Keys | ||
.Where(x => !LocalizationOptions.Resources.ContainsKey(x)) | ||
.ToArray(); | ||
; } | ||
|
||
public virtual async Task<LocalizationResourceBase[]> GetResourcesAsync() | ||
{ | ||
var configurationDto = await ConfigurationClient.GetAsync(); | ||
var resources = new List<LocalizationResourceBase>(); | ||
|
||
foreach (var resource in configurationDto.Localization.Resources) | ||
{ | ||
if (LocalizationOptions.Resources.ContainsKey(resource.Key)) | ||
{ | ||
continue; | ||
} | ||
|
||
resources.Add(CreateNonTypedLocalizationResource(resource.Key, resource.Value)); | ||
} | ||
|
||
return resources.ToArray(); | ||
} | ||
|
||
protected virtual LocalizationResourceBase CreateLocalizationResourceFromConfigurationOrNull( | ||
string resourceName, | ||
ApplicationConfigurationDto configurationDto) | ||
{ | ||
var resourceDto = configurationDto.Localization.Resources.GetOrDefault(resourceName); | ||
|
||
if (resourceDto == null) | ||
{ | ||
return null; | ||
} | ||
|
||
return CreateNonTypedLocalizationResource(resourceName, resourceDto); | ||
} | ||
|
||
protected virtual NonTypedLocalizationResource CreateNonTypedLocalizationResource( | ||
string resourceName, | ||
ApplicationLocalizationResourceDto resourceDto) | ||
{ | ||
return new NonTypedLocalizationResource(resourceName) | ||
.AddBaseResources(resourceDto.BaseResources); | ||
} | ||
} |
Oops, something went wrong.