|
|
@ -51,7 +51,7 @@ namespace Microsoft.AspNetCore.Components.WebAssembly.Hosting |
|
|
using (var scope = serviceProvider.CreateScope()) |
|
|
using (var scope = serviceProvider.CreateScope()) |
|
|
{ |
|
|
{ |
|
|
await InitializeModulesAsync(scope.ServiceProvider); |
|
|
await InitializeModulesAsync(scope.ServiceProvider); |
|
|
SetCurrentLanguage(scope); |
|
|
await SetCurrentLanguageAsync(scope); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -63,9 +63,10 @@ namespace Microsoft.AspNetCore.Components.WebAssembly.Hosting |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private static void SetCurrentLanguage(IServiceScope scope) |
|
|
private async static Task SetCurrentLanguageAsync(IServiceScope scope) |
|
|
{ |
|
|
{ |
|
|
var configurationClient = scope.ServiceProvider.GetRequiredService<ICachedApplicationConfigurationClient>(); |
|
|
var configurationClient = scope.ServiceProvider.GetRequiredService<ICachedApplicationConfigurationClient>(); |
|
|
|
|
|
var utilsService = scope.ServiceProvider.GetRequiredService<IAbpUtilsService>(); |
|
|
var configuration = configurationClient.Get(); |
|
|
var configuration = configurationClient.Get(); |
|
|
var cultureName = configuration.Localization?.CurrentCulture?.CultureName; |
|
|
var cultureName = configuration.Localization?.CurrentCulture?.CultureName; |
|
|
if (!cultureName.IsNullOrEmpty()) |
|
|
if (!cultureName.IsNullOrEmpty()) |
|
|
@ -74,6 +75,11 @@ namespace Microsoft.AspNetCore.Components.WebAssembly.Hosting |
|
|
CultureInfo.DefaultThreadCurrentCulture = culture; |
|
|
CultureInfo.DefaultThreadCurrentCulture = culture; |
|
|
CultureInfo.DefaultThreadCurrentUICulture = culture; |
|
|
CultureInfo.DefaultThreadCurrentUICulture = culture; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (CultureInfo.CurrentUICulture.TextInfo.IsRightToLeft) |
|
|
|
|
|
{ |
|
|
|
|
|
await utilsService.AddClassToTagAsync("body", "rtl"); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|