Currently we use a snippet [1] to detect the device language for event logging purposes. The new language overlay proposed at T123384 also needs this code so that the primary device language can be shown in the preferred languages section. In my current WIP patch I decided not to extend the existing language overlay to create the new one because the overlay templates are completely different and it would be unfair for the users of the new overlay to download the old template too. Since inheriting is out of question, we need a place to put that language detection code. I suggested we do it in utils.js [2]. @Jdlrobson thinks it's not a good idea. What do others think?
[1] https://github.com/wikimedia/mediawiki-extensions-MobileFrontend/blob/master/resources/skins.minerva.scripts/init.js#L128
[2] https://gerrit.wikimedia.org/r/#/c/268114/