Shamelessly looking at dialog code to lift, I came across WikiLove's dialog box:
            $dialog = $( '\
<div id="mw-wikilove-dialog">\
    <h2><html:msg key="wikilove-get-started-header"/></h2> ...

Wait, html:msg ?  It calls $dialog.localize() and the whole chunk of DOM gets localized at once.

This has been in core since I believe 1.17, and the AFT,  MoodBar, and WikiLove extensions use it. I'm not sure why it's not mentioned in Localisation or Manual:Messages API . I just added it to Resource Loader modules page.

Why isn't newer code using it, did it fall out of favor? E.g. Echo uses jQuery chaining:
   $( '<a>' ).attr(...).text( mw.msg( 'echo-overlay-link' ) ). ...

jquery.localize() doesn't give you the control of mw.msg().escape/parse/plain/text() , but for big basic chunks of HTML it seems ideal.

Thanks for any insight,
--
=S Page  software engineer on E3