Oink oink!
(If you are using a phone / mobile see further down).

Copy the JavaScript code below and navigate to any website of your choosing. In the URL bar, replace the existing URL with:

javascript:

and then paste the JavaScript code after it. Press enter. Bing bang boom you just translated the website into pig latin!

Oink.
Alternatively, you can create a bookmarklet to easily run this on a website whenever you want! Just drag this link: PIG LATIN to your bookmarks bar/folder, navigate to a webpage, and then click the bookmark.

Phone/Mobile Platforms On a mobile platform, it's a bit trickier:

Set up a bookmarklet. We need to first create a bookmark and then edit it.

  1. Bookmark this page (in Safari this is in the "share" share icon menu)
  2. Copy the code below using the button
  3. Go into your bookmarks (book icon) and find the "Pig Latin" bookmark you just created.
  4. Tap "edit" and tap the "Pig Latin" bookmark to edit it
  5. Replace the existing URL of the bookmark with javascript: followed by the code below (which you copied in step 2)
  6. Tap done

Use the bookmarklet:

  1. Navigate to a webpage, and then open the Pig Latin bookmark. It should translate the page into Pig Latin.
(() => { const textNodesIn = function (el) { var textNodes = []; var n; /*current node*/ var treeWalker = document.createTreeWalker(el, NodeFilter.SHOW_TEXT, null, false); /*args: root node, whatToShow property, additional filter, entityReferenceExpansion(some weird thing when parsing)*/ while (n = treeWalker.nextNode()) { textNodes.push(n); } /*condition calls nextNode function, moving the tree walker to next node (and setting n to this to improve efficiency)*/ /*if there is no next node, condition evaluates to false*/ return textNodes; }; const alterWord = function (word) { var isCapitalized = /[A-Z]/.test(word[0]); /* if first letter is a vowel, add 'way' to end */ if (/a|e|i|o|u/i.test(word[0])) { word = word + "way"; } else { /*otherwise move all beginning consonants to end and add 'ay' */ word = word.replace(/(^[^aeiou]+)(.*)/i, "$2$1ay"); /*'$1' is 1st parentheses (the consonants at beginning), '$2' is 2nd paren. (rest of word)*/ } /* take care of capitalization */ word = word.toLowerCase(); if (isCapitalized) { word = word.replace(/^\w/, function (match) { return match.toUpperCase(); }); } return word; }; const alterText = function (text) { /* call alterWord for each word, replace with what it returns */ return text.replace(/[A-Za-z']+/g, function (match) { return alterWord(match); }); }; /* execute file on document -------------------------- */ const body = document.getElementsByTagName("body")[0]; const textNodes = textNodesIn(body); for (var i = 0, l = textNodes.length; i < l; i++) { if (textNodes[i].parentNode.nodeName !== "SCRIPT") { textNodes[i].textContent = alterText(textNodes[i].textContent); } } })();