|
|
@ -1,15 +1,12 @@ |
|
|
using System; |
|
|
using System; |
|
|
using System.Globalization; |
|
|
|
|
|
using System.Runtime.CompilerServices; |
|
|
using System.Runtime.CompilerServices; |
|
|
using System.Threading.Tasks; |
|
|
using System.Threading.Tasks; |
|
|
using JetBrains.Annotations; |
|
|
using JetBrains.Annotations; |
|
|
using Microsoft.Extensions.Configuration; |
|
|
using Microsoft.Extensions.Configuration; |
|
|
using Microsoft.Extensions.DependencyInjection; |
|
|
using Microsoft.Extensions.DependencyInjection; |
|
|
using Volo.Abp; |
|
|
using Volo.Abp; |
|
|
using Volo.Abp.AspNetCore.Components.Web; |
|
|
|
|
|
using Volo.Abp.AspNetCore.Components.Web.DependencyInjection; |
|
|
using Volo.Abp.AspNetCore.Components.Web.DependencyInjection; |
|
|
using Volo.Abp.AspNetCore.Components.WebAssembly; |
|
|
using Volo.Abp.AspNetCore.Components.WebAssembly; |
|
|
using Volo.Abp.AspNetCore.Mvc.Client; |
|
|
|
|
|
using Volo.Abp.DependencyInjection; |
|
|
using Volo.Abp.DependencyInjection; |
|
|
using Volo.Abp.Modularity; |
|
|
using Volo.Abp.Modularity; |
|
|
|
|
|
|
|
|
@ -76,34 +73,5 @@ public static class AbpWebAssemblyHostBuilderExtensions |
|
|
.GetRequiredService<IClientScopeServiceProviderAccessor>()).ServiceProvider = serviceProvider; |
|
|
.GetRequiredService<IClientScopeServiceProviderAccessor>()).ServiceProvider = serviceProvider; |
|
|
|
|
|
|
|
|
await application.InitializeAsync(serviceProvider); |
|
|
await application.InitializeAsync(serviceProvider); |
|
|
await InitializeModulesAsync(serviceProvider); |
|
|
|
|
|
await SetCurrentLanguageAsync(serviceProvider); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private async static Task InitializeModulesAsync(IServiceProvider serviceProvider) |
|
|
|
|
|
{ |
|
|
|
|
|
foreach (var service in serviceProvider.GetServices<IAsyncInitialize>()) |
|
|
|
|
|
{ |
|
|
|
|
|
await service.InitializeAsync(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private async static Task SetCurrentLanguageAsync(IServiceProvider serviceProvider) |
|
|
|
|
|
{ |
|
|
|
|
|
var configurationClient = serviceProvider.GetRequiredService<ICachedApplicationConfigurationClient>(); |
|
|
|
|
|
var utilsService = serviceProvider.GetRequiredService<IAbpUtilsService>(); |
|
|
|
|
|
var configuration = await configurationClient.GetAsync(); |
|
|
|
|
|
var cultureName = configuration.Localization?.CurrentCulture?.CultureName; |
|
|
|
|
|
if (!cultureName.IsNullOrEmpty()) |
|
|
|
|
|
{ |
|
|
|
|
|
var culture = new CultureInfo(cultureName); |
|
|
|
|
|
CultureInfo.DefaultThreadCurrentCulture = culture; |
|
|
|
|
|
CultureInfo.DefaultThreadCurrentUICulture = culture; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (CultureInfo.CurrentUICulture.TextInfo.IsRightToLeft) |
|
|
|
|
|
{ |
|
|
|
|
|
await utilsService.AddClassToTagAsync("body", "rtl"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|