Skip to content

Instantly share code, notes, and snippets.

@poke
Last active October 5, 2022 10:11
Show Gist options
  • Save poke/443691326ead282667e12ddb3165f103 to your computer and use it in GitHub Desktop.
Save poke/443691326ead282667e12ddb3165f103 to your computer and use it in GitHub Desktop.
[User script] Microsoft Docs: Force English
// ==UserScript==
// @id microsoft-docs-force-english@poke
// @name Microsoft Docs: Force English
// @description Force Microsoft Docs and MDN to be displayed in English, regardless of the browser’s locale settings.
// @namespace poke
// @version 3.0.0
// @author Patrick Westerhoff
// @grant none
// @include https://docs.microsoft.com/*
// @include https://learn.microsoft.com/*
// @include https://developer.mozilla.org/*
// @homepageURL https://gist.github.com/poke/443691326ead282667e12ddb3165f103
// @updateURL https://gist.github.com/poke/443691326ead282667e12ddb3165f103/raw/microsoft-docs-force-english.user.js
// ==/UserScript==
const parts = window.location.pathname.match(/^\/([a-z]{2}(?:-[a-z]{2})?)\/(.*?)$/);
if (!parts[1].startsWith('en')) {
window.location.pathname = '/en/' + parts[2];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment