Fix switching language should not make the lang attribute empty (#8831)

* Fix switching language should not make the lang attribute empty

* Use name field
This commit is contained in:
Leilei332
2024-12-20 14:25:16 +00:00
committed by GitHub
parent e8a23e9bcc
commit 49a33ae467
+1
View File
@@ -88,6 +88,7 @@ exports.startup = function() {
if($tw.browser) {
var pluginTiddler = $tw.wiki.getTiddler(plugins[0]);
if(pluginTiddler) {
document.documentElement.setAttribute("lang",pluginTiddler.getFieldString("name"));
document.documentElement.setAttribute("dir",pluginTiddler.getFieldString("text-direction") || "auto");
} else {
document.documentElement.removeAttribute("dir");