When we create an items on the fly to allow pages on two client wikis to be connected via sitelinks, we should use the correct language code for the labels of the new item. The "link pages" JS code derives labels from the page titles, which are (by definition) in the wiki's content language. So we need to know the content language for both wikis involved. In particular, we have to know the content language of the "other" wiki.
We use the other wiki's interwiki prefix (or subdomain?) and hope that this is the content language. This is not true e.g. for the case of simple.wikipedia.org: it's interwiki prefix is "simple", while the content language is "en".
To get the "other" wiki's content language, we should use information from the Site facility. Note however that the Site facility does not currently have the correct information on content language or even interwiki prefix for all wikis on the Wikimedia cluster.