I spend a lot of time reading Wikipedia. Most often because I'm suddenly curious about something, type @wikien (my own shortcut for English Wikipedia) into Firefox's address bar, hit the down arrow key, and then type the name of the thing in question in English. I also have shortcuts for @wikija (Japanese Wikipedia), @wikieo (Esperanto Wikipedia), @wikino (Norwegian Bokmål Wikipedia) and @wikiru (Russian Wikipedia), but I use these shortcuts way less often than @wikien despite wanting to increase the proportion of non-English reading I do online.
Even if I don't use these shortcuts I've set up, it is of course always possible to click on the language dropdown and select a different language if I really want to read a specific Wikipedia article in a specific language, but this adds "friction" don't people say, so I always end up just reading what I was curious about on English Wikipedia and then closing the tab. So wouldn't it be nice if I could look something up on English Wikipedia and have it automatically redirect to the equivalent article on Norwegian Wikipedia? I think that would be nice, but evidently nobody has ever made such a browser extension despite how easy it seems like it would be. Wikipedia's API has a feature for finding equivalent articles between different languages, right? Surely you could use that for this sort of project, right?
I imagine the Wikipedia Language Redirector browser extension working like this for the end user: you click on the Wikipedia Language Redirector icon in the corner of your web browser, and it opens a popup with (1) a simple button for enabling or disabling the redirector; (2) a searchable list of different editions of Wikipedia, sorted from most to least articles, with names in their respective languages.
Every entry in this list of Wikipedias has two buttons: a pin icon and a prohibition icon. These buttons are for respectively pinning and denylisting that version of Wikipedia. Pinned Wikipedias are marked in blue and moved to the top of the list, and can be dragged up and down relative to each other to prioritize them. Denylisted Wikipedias are marked in red and also moved to the top of the list, just beneath the pinned Wikipedias. The prohibition icon on denylisted Wikipedias is replaced with a checkmark icon for moving that Wikipedia back to the allowlist.
So for myself, I might set English Wikipedia (en.wikipedia.org / 7,135,897 articles) as denylisted, and then pin these Wikipedias in this order:
- Norwegian Bokmål (no.wikipedia.org / 672,884 articles)
- Norwegian Nynorsk (nn.wikipedia.org / 177,247 articles)
- Danish (da.wikipedia.org / 312,694 articles)
- Swedish (sv.wikipedia.org / 2,621,329 articles)
- Esperanto (eo.wikipedia.org / 381,760 articles)
- Toki Pona (tok.wikipedia.org / 3,570 articles)
- Russian (ru.wikipedia.org / 2,085,436 articles)
- Japanese (ja.wikipedia.org / 1,489,743 articles)
- Chinese (zh.wikipedia.org / 1,523,539 articles)
The behavior of the Wikipedia Language Redirector browser extension is then that when it notices I'm on denylisted English Wikipedia, it will first check if there's an equivalent article on Norwegian Bokmål Wikipedia; then if there isn't, it will check Norwegian Nynorsk Wikipedia; then Danish, Swedish, etc, in my chosen order, and if none of my pinned languages have an equivalent to the article I'm looking for, Wikipedia Language Redirector will just give up and load the English Wikipedia article anyways.
If I'm looking at an allowlisted but not necessarily pinned edition of Wikipedia, the extension just does nothing.
You can install the Firemonkey extension.
and use it to run this script
You must include https:// in links
ⓘ This user is suspected of being a cat. Please report any suspicious behavior.
it works on my machine
It doesn't on mine.
ⓘ This user is suspected of being a cat. Please report any suspicious behavior.
Doesn't seem to work quite as it's supposed to, but this is a really great start and I'm really glad you'd throw this together for me in a pinch.
Unexpected behavior (note: I'm running the script through TamperMonkey rather than FireMonkey):
Edit: Thanks Edie for fixing issues 2 and 3
Those are all features ... to uh help you avoid wiki rabbit holes yeah that's it.
2 (and to some extent 3) can be fixed by replacing
with
ⓘ This user is suspected of being a cat. Please report any suspicious behavior.
That worked, awesome! Should've probably figured that out myself, but at least it was a simple enough issue to solve.
Also I think you can remove
it doesn't actually seem to make a difference.
ⓘ This user is suspected of being a cat. Please report any suspicious behavior.
I don't notice any difference, either.
Here is my modified version which seems to work better. The original one would continuously attempt to navigate to a page, resulting in firefox creating an error, whereas mine doesn't. I have removed the unnecessary open checkbox. And I have fixed norsk bokmål being
nbnotnoscript
ⓘ This user is suspected of being a cat. Please report any suspicious behavior.
Seems to work perfectly, and a lot faster! Thank you for your service, and @Enjoyer_of_Games@hexbear.net for the original version of the script.
Also, it seems it is unnecessary to open the checkbox? And I get this warning: "Too many calls to Location or History APIs within a short timeframe." which makes sense, there is no check in the code to not attempt to navigate to a page once we have done so. It works, but there are problems.
ⓘ This user is suspected of being a cat. Please report any suspicious behavior.