From c0a5c28d800ad835290d4b80e7df0f7a8e43796f Mon Sep 17 00:00:00 2001 From: Aidan Gauland Date: Sat, 25 Nov 2017 22:58:52 +1300 Subject: [PATCH 1/3] Set html lang attribute from language setting --- src/vector/index.html | 2 +- src/vector/index.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/vector/index.html b/src/vector/index.html index 8568d96a..f930b6d2 100644 --- a/src/vector/index.html +++ b/src/vector/index.html @@ -1,5 +1,5 @@ - + Riot diff --git a/src/vector/index.js b/src/vector/index.js index 46ef706e..fe326e16 100644 --- a/src/vector/index.js +++ b/src/vector/index.js @@ -382,6 +382,7 @@ async function loadLanguage() { } try { await languageHandler.setLanguage(langs); + document.getElementById("root").setAttribute("lang", languageHandler.getCurrentLanguage()); } catch (e) { console.error("Unable to set language", e); } From 43b3c013f26177d7037f7ad0b3326c4eade62232 Mon Sep 17 00:00:00 2001 From: Aidan Gauland Date: Sun, 26 Nov 2017 09:49:39 +1300 Subject: [PATCH 2/3] Change html root id Change the root element id to follow Matrix naming conventions. --- src/vector/index.html | 2 +- src/vector/index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vector/index.html b/src/vector/index.html index f930b6d2..172ccfab 100644 --- a/src/vector/index.html +++ b/src/vector/index.html @@ -1,5 +1,5 @@ - + Riot diff --git a/src/vector/index.js b/src/vector/index.js index fe326e16..c154919b 100644 --- a/src/vector/index.js +++ b/src/vector/index.js @@ -382,7 +382,7 @@ async function loadLanguage() { } try { await languageHandler.setLanguage(langs); - document.getElementById("root").setAttribute("lang", languageHandler.getCurrentLanguage()); + document.getElementById("mx_PageRoot").setAttribute("lang", languageHandler.getCurrentLanguage()); } catch (e) { console.error("Unable to set language", e); } From c4dc59dc413d83b48fd9a84ea427a1ff76d0544c Mon Sep 17 00:00:00 2001 From: Aidan Gauland Date: Sun, 26 Nov 2017 13:46:47 +1300 Subject: [PATCH 3/3] Use documentElement instead of getElementById Use documentElement to get the root element instead of adding an id to the root element. --- src/vector/index.html | 2 +- src/vector/index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vector/index.html b/src/vector/index.html index 172ccfab..8568d96a 100644 --- a/src/vector/index.html +++ b/src/vector/index.html @@ -1,5 +1,5 @@ - + Riot diff --git a/src/vector/index.js b/src/vector/index.js index c154919b..5ac42d8a 100644 --- a/src/vector/index.js +++ b/src/vector/index.js @@ -382,7 +382,7 @@ async function loadLanguage() { } try { await languageHandler.setLanguage(langs); - document.getElementById("mx_PageRoot").setAttribute("lang", languageHandler.getCurrentLanguage()); + document.documentElement.setAttribute("lang", languageHandler.getCurrentLanguage()); } catch (e) { console.error("Unable to set language", e); }