From f1e71115835f39fd0948108b70acbcbe593814b3 Mon Sep 17 00:00:00 2001 From: Engincan VESKE Date: Wed, 20 Oct 2021 13:58:42 +0300 Subject: [PATCH] Module template: Add dir and lang attributes to html tag for Blazor (RTL) --- .../wwwroot/index.html | 13 +++++++------ .../wwwroot/main.js | 17 +++++++++++++++++ 2 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Host/wwwroot/main.js diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Host/wwwroot/index.html b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Host/wwwroot/index.html index aab3b87b3f..ce819dfbdb 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Host/wwwroot/index.html +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Host/wwwroot/index.html @@ -14,16 +14,17 @@ -
-
-
-
+
+
+
+
+
-
- + + diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Host/wwwroot/main.js b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Host/wwwroot/main.js new file mode 100644 index 0000000000..a1f62022d8 --- /dev/null +++ b/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"); + } + } + } +)(); \ No newline at end of file