Browse Source

Merge pull request #19514 from abpframework/AspNetCore.Culture

Add `.AspNetCore.Culture` cookie when changing language.
pull/19516/head
Enis Necipoglu 3 years ago
committed by GitHub
parent
commit
7c8628ce74
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 16
      modules/basic-theme/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/Themes/Basic/LanguageSwitch.razor

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

@ -57,13 +57,21 @@
{ {
await JsRuntime.InvokeVoidAsync( await JsRuntime.InvokeVoidAsync(
"localStorage.setItem", "localStorage.setItem",
"Abp.SelectedLanguage", language.UiCultureName "Abp.SelectedLanguage",
); language.UiCultureName
);
await JsRuntime.InvokeVoidAsync( await JsRuntime.InvokeVoidAsync(
"localStorage.setItem", "localStorage.setItem",
"Abp.IsRtl", CultureInfo.GetCultureInfo(language.UiCultureName).TextInfo.IsRightToLeft "Abp.IsRtl",
); CultureInfo.GetCultureInfo(language.UiCultureName).TextInfo.IsRightToLeft
);
await JsRuntime.InvokeVoidAsync(
"abp.utils.setCookieValue",
".AspNetCore.Culture",
$"c={language.CultureName}|uic={language.UiCultureName}"
);
await JsRuntime.InvokeVoidAsync("location.reload"); await JsRuntime.InvokeVoidAsync("location.reload");
} }

Loading…
Cancel
Save