The code snippet shown below can be called from inside the specific SharePoint Page.
e.g AllItems.aspx page inside a Document Library/List.
This javascript function needs to be called on Page load event using _spBodyOnLoadFunctionNames.push method.
<script language="javascript" type="text/javascript">
_spBodyOnLoadFunctionNames.push("renameMenuItem('New', 'My New')");
_spBodyOnLoadFunctionNames.push("renameMenuItem('Settings', 'My Settings')");
function renameMenuItem(oldMenuItemName, newMenuItemName)
{
var vAnchorTag;
var vAllAnchorTags = document.getElementsByTagName('a');
if(oldMenuItemName.length!=0)
{
for (var j = 0; j < vAllAnchorTags.length; j++)
{
vAnchorTag = vAllAnchorTags[j];
if (vAnchorTag.innerText.indexOf(oldMenuItemName)!=-1)
{
vAnchorTag.innerText = newMenuItemName;
try
{
if(newMenuItemName.length != 0)
{
vAnchorTag.parentNode.previousSibling.firstChild.firstChild.alt
= newMenuItemName;
}
else
{
vAnchorTag.parentNode.previousSibling.firstChild.firstChild.alt
= oldMenuItemName;
}
}
catch(err)
{
}
}
} // End For
} // End If
}// End Function
</script>