Skip to content

Instantly share code, notes, and snippets.

@joeljuca
Forked from kuanyui/always-english-mozilla-doc.user.js
Last active February 5, 2021 22:35
Show Gist options
  • Save joeljuca/90a4977d8f6f48438145036cd2ba419f to your computer and use it in GitHub Desktop.
Save joeljuca/90a4977d8f6f48438145036cd2ba419f to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name MDN always in en-US
// @version 1
// @grant none
// @match https://developer.mozilla.org/*
// @run-at document-start
// ==/UserScript==
(function () {
const url = document && document.location && document.location.host;
console.debug({ path });
if (url !== "developer.mozilla.org") return;
const engLangTag = "en-US";
const path = document.location.pathname;
console.debug({ path });
if (path.substring(0, `/${engLangTag}`.length) === `/${engLangTag}`) return;
console.info("Changing MDN language to English");
const newPath = "/"
.concat(engLangTag)
.concat(path.substring(path.split("/").filter(Boolean)[0].length + 1));
console.debug({ newPath });
window.location.replace(newPath);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment