Page MenuHomePhabricator

Adding language links is not possible in the new language selector view
Closed, DuplicatePublicBUG REPORT

Description

fawiki is among the pilot wikis on which latest Desktop Improvements are being implemented. The new language selector (which displays in the page header) got recently deployed. It works fine when there are language links. But, when a page is still not connected to a Wikidata entry, it used to be possible to add a language link in the old view with a few clicks and without leaving fawiki but now it is not possible.

This is how the legacy Vector looked like, and I have marked in red the link that would allow you to add a lang link without leaving fawiki:

image.png (204×160 px, 9 KB)

This feature is now missing; essentially, the latest Desktop Improvement has introduced a regression.

PS: if it helps, the code behind that screenshot is this and there is a JS script that overrides the click event for the link with class=wbc-editpage but I don't know where that JS actually lives.

Event Timeline

FYI, I posted a temporary (global?) gadget in the other ticket:

var wid = mw.config.get('wgWikibaseItemId');
var url = 'https://www.wikidata.org/wiki/Special:EntityPage/' + wid + '#sitelinks-wikipedia';
if ( $('.wb-langlinks-edit').length ) {
  $('.wb-langlinks-edit').insertAfter('#p-lang-btn');
} else {
  $('<a>').attr('href', url ).text( mw.msg( 'wikibase-editlinks' ) ).insertAfter( '#firstHeading' )
}

(edited to include link on pages without languages)

That does not work; if the language selector is not shown (which is the case when the page has no lang links), then your code will not show anything either because #p-lang-btn does not exist. Even changing that to something else such as $('.wb-langlinks-edit').insertAfter('#t-print'); won't help either because .wb-langlinks-edit also does not exist in this situation.

You can try it on this page as an example.

Right, sorry I forgot to add that caveat.

I believe the script could also add a link to
https://www.wikidata.org/wiki/Special:EntityPage/Q___#sitelinks-wikipedia sourcing the Q code from mw.config with an additional line for completeness.