Browse Source

Merge pull request #10374 from abpframework/EngincanV/bs5-blazor-rtl

Add RTL support to templates for Blazor Wasm
pull/10381/head
Ahmet Çotur 5 years ago
committed by GitHub
parent
commit
5f3d90ec3b
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      modules/basic-theme/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/Themes/Basic/LanguageSwitch.razor
  2. 1
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/wwwroot/index.html
  3. 17
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/wwwroot/main.js
  4. 13
      templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Host/wwwroot/index.html
  5. 17
      templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Host/wwwroot/main.js

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

@ -60,6 +60,11 @@
"Abp.SelectedLanguage", language.UiCultureName
);
await JsRuntime.InvokeVoidAsync(
"localStorage.setItem",
"Abp.IsRtl", CultureInfo.GetCultureInfo(language.UiCultureName).TextInfo.IsRightToLeft
);
await JsRuntime.InvokeVoidAsync("location.reload");
}
}

1
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/wwwroot/index.html

@ -26,5 +26,6 @@
<script src="global.js?_v=637701705558615007"></script>
<!--/ABP:Scripts-->
<script src="main.js"></script>
</body>
</html>

17
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/wwwroot/main.js

@ -0,0 +1,17 @@
(
function () {
var isRtl = JSON.parse(localStorage.getItem("Abp.IsRtl"));
var htmlTag = document.getElementsByTagName("html")[0];
if (htmlTag) {
var selectedLanguage = localStorage.getItem("Abp.SelectedLanguage");
if (selectedLanguage) {
htmlTag.setAttribute("lang", selectedLanguage);
}
if (isRtl) {
htmlTag.setAttribute("dir", "rtl");
}
}
}
)();

13
templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Host/wwwroot/index.html

@ -14,16 +14,17 @@
</head>
<body class="abp-application-layout bg-light">
<div id="ApplicationContainer">
<div class="spinner">
<div class="double-bounce1"></div>
<div class="double-bounce2"></div>
<div id="ApplicationContainer">
<div class="spinner">
<div class="double-bounce1"></div>
<div class="double-bounce2"></div>
</div>
</div>
</div>
<!--ABP:Scripts-->
<!--ABP:Scripts-->
<script src="global.js?_v=637701706654165281"></script>
<!--/ABP:Scripts-->
<script src="main.js"></script>
</body>
</html>

17
templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Host/wwwroot/main.js

@ -0,0 +1,17 @@
(
function () {
var isRtl = JSON.parse(localStorage.getItem("Abp.IsRtl"));
var htmlTag = document.getElementsByTagName("html")[0];
if (htmlTag) {
var selectedLanguage = localStorage.getItem("Abp.SelectedLanguage");
if (selectedLanguage) {
htmlTag.setAttribute("lang", selectedLanguage);
}
if (isRtl) {
htmlTag.setAttribute("dir", "rtl");
}
}
}
)();
Loading…
Cancel
Save