Custom code to translate "Old password" and "New password" labels of user profile block

Place this code in page settings → Custom code → Footer section, replace the BLOCKID with your block name, save and preview

<script>
    window.addEventListener('block-loaded-BLOCKID', () => {
        setTimeout(()=>{
            [...document.querySelectorAll('#BLOCKID .form-input-label')].forEach((label)=>{
            if(label.innerText == "Old password"){
                label.innerText = "TRANSLATION FOR OLD PASSWORD"
            }
            if(label.innerText == "New password"){
                label.innerText = "TRANSLATION FOR NEW PASSWORD"
            }
        })
        }, 100);
    });
</script>
2 Likes