Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
$(function (){
 
document.getElementById("pt-mytalk").firstChild.innerHTML = "talk";
document.getElementById("pt-preferences").firstChild.innerHTML = "prefs";
document.getElementById("pt-watchlist").firstChild.innerHTML = "watch";
document.getElementById("pt-mycontris").firstChild.innerHTML = "contribs";
document.getElementById("pt-logout").firstChild.innerHTML = "logout";
hack_addSandboxPortletLink();
 
});

function hack_addSandboxPortletLink() {
    var node = document.getElementById("p-personal");
    if ( !node ) return null;
    node = node.getElementsByTagName( "ul" )[0];
    if ( !node ) return null;

    var link = document.createElement( "a" );
    link.appendChild( document.createTextNode( "sandbox" ) );
    link.href = "/wiki/Special:MyPage/Sandboxes";
    
    var item = document.createElement( "li" );
    item.appendChild( link );
    item.id = "pt-mysandbox";

    link.setAttribute( "title", "Go to your sandbox" );
    
    var nextnode = document.getElementById("pt-preferences");
    if ( nextnode && nextnode.parentNode == node )
        node.insertBefore( item, nextnode );
    else
        node.appendChild( item );  // IE compatibility (?)
    
    return item;
}