Commit 999a03e4 authored by Aarni Koskela's avatar Aarni Koskela
Browse files

Wait for DOMContentLoaded until checking whether localization should be disabled

parent 9080af56
Loading
Loading
Loading
Loading
+21 −20
Original line number Diff line number Diff line
@@ -137,7 +137,11 @@ function download_localization() {
    document.body.removeChild(element);
}

if(hasLocalization()) {
document.addEventListener("DOMContentLoaded", function () {
    if (!hasLocalization()) {
        return;
    }

    onUiUpdate(function (m) {
        m.forEach(function (mutation) {
            mutation.addedNodes.forEach(function (node) {
@@ -146,8 +150,6 @@ if(hasLocalization()) {
        });
    })


    document.addEventListener("DOMContentLoaded", function () {
    processNode(gradioApp())

    if (localization.rtl) {  // if the language is from right to left,
@@ -168,4 +170,3 @@ if(hasLocalization()) {
        })).observe(gradioApp(), { childList: true });
    }
})
}