Browse Source

Merge pull request #21923 from abpframework/auto-merge/rel-9-0/3400

Merge branch rel-9.1 with rel-9.0
pull/21924/head
maliming 2 years ago
committed by GitHub
parent
commit
7c2119a975
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 15
      modules/basic-theme/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/Themes/Basic/LanguageSwitch.razor

15
modules/basic-theme/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/Themes/Basic/LanguageSwitch.razor

@ -1,8 +1,10 @@
@using Volo.Abp.Localization @using Volo.Abp.Localization
@using System.Globalization @using System.Globalization
@using System.Collections.Immutable @using System.Collections.Immutable
@using Volo.Abp.AspNetCore.Components.Web
@inject ILanguageProvider LanguageProvider @inject ILanguageProvider LanguageProvider
@inject IJSRuntime JsRuntime @inject IJSRuntime JsRuntime
@inject ICookieService CookieService
@if (_otherLanguages != null && _otherLanguages.Any()) @if (_otherLanguages != null && _otherLanguages.Any())
{ {
<BarDropdown RightAligned="true"> <BarDropdown RightAligned="true">
@ -57,20 +59,23 @@
{ {
await JsRuntime.InvokeVoidAsync( await JsRuntime.InvokeVoidAsync(
"localStorage.setItem", "localStorage.setItem",
"Abp.SelectedLanguage", "Abp.SelectedLanguage",
language.UiCultureName language.UiCultureName
); );
await JsRuntime.InvokeVoidAsync( await JsRuntime.InvokeVoidAsync(
"localStorage.setItem", "localStorage.setItem",
"Abp.IsRtl", "Abp.IsRtl",
CultureInfo.GetCultureInfo(language.UiCultureName).TextInfo.IsRightToLeft CultureInfo.GetCultureInfo(language.UiCultureName).TextInfo.IsRightToLeft
); );
await JsRuntime.InvokeVoidAsync( await CookieService.SetAsync(
"abp.utils.setCookieValue",
".AspNetCore.Culture", ".AspNetCore.Culture",
$"c={language.CultureName}|uic={language.UiCultureName}" $"c={language.CultureName}|uic={language.UiCultureName}",
new CookieOptions
{
Path = "/"
}
); );
await JsRuntime.InvokeVoidAsync("location.reload"); await JsRuntime.InvokeVoidAsync("location.reload");

Loading…
Cancel
Save