Board Thread:Code Review/@comment-11733175-20170212225820/@comment-24473195-20170215092914

MediaWiki uses a fallback chain dependent on language similarity and a bit of politics. For example, Spanish is linguistically similar to Portuguese, and so both Spanish and Portuguese may be designed to fallback to each other. Ukrainian used to fall back to  Russian, but due to politics now falls back to English. In some cases having the fallback to similar languages may be confusing because the written language may look similar but have completely different meaning. There are of course exceptions and other historical reasons for some of the fallback chains.

I'm not sure why you're reinventing the wheel though, you can just check the fallback straight from mediawiki itself unless you want to avoid an extra api request. That can be avoided by saving the user's fallback to local storage.

Anyway, see "fallback" in https://www.mediawiki.org/wiki/API:Siteinfo:

https://fr.wikipedia.org/wiki/Sp%C3%A9cial:ApiSandbox#action=query&format=json&prop=&meta=siteinfo&siprop=general