Edge Rewrite
// request.cf · coarse context

A page that knows where it met you.

Only coarse request metadata is shown. This demo does not display or persist visitor IP addresses.

Country
US
Cloudflare location
CMH
Connection
HTTP/2
Language
Not provided

Ray ID: a224dbcf1e733e6e

Jump to content

Wikipedia talk:Lua

Page contents not supported in other languages.
Add topic
From Wikipedia, the free encyclopedia
(Redirected from Module talk:Example/sandbox)
Latest comment: 25 days ago by קיפודנחש in topic Edit request for consideration

WD or interwiki question

[edit]

hi all.

i think i'm reasonably proficient with scribuntu, but one area i never dabbled in is wikibase.

i did RTFM, but failed to find the answer, so asking here:

given a wiki language (say, 'en', 'fr' or 'de') and an article name in that language, i want to get the WD item id (aka QID) of this article.

phase II will be checking to see if there is an article in some _other_ language for same QID, aka "interwiki". bonus points for name of said interwiki in 2nd wiki (in my use case, this 2nd wiki will be the local one).

i believe i'll be able to overcome phase II myself (though i'll appreciate guidance there too), but i hit a wall in step 1: given lang and article name, get QID.

rationale: in hewiki (and prolly elsewhere), we often attach link to existing "foreign" article next to "red" internal links. when writing an article about X, the author may add a red link to Y which does not yet exist in local wiki but does exist in some other wiki. in those cases, the author sometimes adds a link to the "foreign" wikipedia after the redlink (think "poor man's internal link" for readers proficient in this other language). we have a bunch of "foreign link templates" to facilitate those foreign wiki links. now, a year or ten later, someone may finally write article Y locally. this may or may not paint the redlink blue (it can fail if the spelling of the redlink differs from the actual article name - transliteration is not a precise science). when the redlink was painted blue, we simply want to remove the "foreign" link, and when it wasn't, we want to correct the spelling _and_ remove the foreign link. to facilitate this, i'd like to add a maintenance cat for "foreign link template where local article exists". the idea is to teach those "foreign link templates" to add a maintenance category to help with this gnoming task.

TL;DR given a language and article name, find wikidata QID of this article in that language.

thanks in advance,

peace - קיפודנחש (aka kipod) (talk) 22:46, 11 May 2026 (UTC)Reply

Does this not do what you want?
mw.wikibase.getEntityIdForTitle('Abraham Lincoln', 'enwiki') → Q91 → Abraham Lincoln (Q91)
mw.wikibase.getEntityIdForTitle('Abraham Lincoln', 'frwiki')
mw.wikibase.getEntityIdForTitle('Abraham Lincoln', 'dewiki')
and:
mw.wikibase.getEntity('Q91').sitelinks.hewiki → אברהם לינקולן and Q91
mw.wikibase.getEntityIdForTitle('אברהם לינקולן', 'hewiki') → Q91
Trappist the monk (talk) 00:07, 12 May 2026 (UTC)Reply
thank you so much!
i'm sure this appears somewhere in the doc and it's only my flawed reading comprehension skills which made me miss it...
peace. קיפודנחש (aka kipod) (talk) 14:56, 12 May 2026 (UTC)Reply
@Trappist the monk:
FWIW, you may want to look at the module i knitted. it's here: he:יחידה:קישורים לוויקיפדיות זרות.
this adds maintenance cats to pages which contain a "foreign wiki link" template which points to either non-existent page on the other wiki (we want to fix it) or a page which already has local interwiki (we want to remove the foreign-wiki link).
there are 2 weak points, but i do not expect a solution: when the template points to a "foreign" article which is not yet linked to WD, from the module point of view it does not exist (rare but occasionally happens), and a much more prevalent case, when the template is used to link to a redirect on the other side WD does not recognize it, and says "no such thing". so in some cases, the "links to nothing" test pops false positives
with those limitations, we (hewiki community) still think this is very useful, and again, please accept my gratitude.
peace. קיפודנחש (aka kipod) (talk) 23:30, 13 May 2026 (UTC)Reply
@Trappist the monk (and everyone else):
The module works, and the comrades in hewiki think it's useful. kudos! You have my full gratitude.
One fly in the ointment, though: when the name passed to getEntityIdForTitle() represents a redirect, it returns nil (WD is unaware of redirects - all it knows is the name of the "real" article), ,and we raise the "link to non-existent page on foreign wiki" flag
Is there a way to query WD in a way that "respects" redirects? If not, do you know if scribuntu's "new title" works for titles in other projects? I assume this will be considered "expensive" if it's possible at all, but it may be worth it anyway. any other idea how can i ask "is article X exist in wiki Y" which will return the qid and work for redirects?
Peace קיפודנחש (aka kipod) (talk) 17:04, 15 May 2026 (UTC)Reply
If there is a way to do what you want, I don't know of it. As I understand it, except for the specific cases of wikidata and commons, Scribunto has access only to the project where the module is running. So a module running here cannot see anything at he.wiki so cannot learn that the target is a redirect. You might ask at wikidata to see if there is a way to follow redirects to their canonical titles. I guess I'd be surprised ...
Trappist the monk (talk) 19:12, 15 May 2026 (UTC)Reply
Links can be IDd as redirects via badge on Wikidata, but this is a manual process, so will be prone to inaccuracy. I don't know if those are discoverable in the JSON. Izno (talk) 20:06, 15 May 2026 (UTC)Reply
@קיפודנחש doesn't Template:Interlanguage link do what you are looking for? It also has the category Category:Interlanguage link template existing link. Gonnym (talk) 16:58, 1 July 2026 (UTC)Reply
thanks!
on first glance, it does not.
if i understand correctly, the maintenance category you linked to is based on testing the argument to the template (for local article). we already have something similar on hewiki, and as it turns out, it's very brittle: the editor who added the template may have guessed correctly the local article name, but this is far from guaranteed - we found many uses where local article (i.e., local interwiki of the "foreign" article) exists, but the category was not added because the template spelled a different name, and some cases where a local article was written, but it's not what was meant, and the "correct" one (i.e., matching the the linked foreign article) either doesn't exist, or differs from the one fed to the template.
FWIW, using the very helpful tip i got here (thanks again, @Trappist the monk!), i built a module on hewiki - He:Module:קישורים לוויקיפדיות זרות (easy read, 150 lines), and we added it to all templates of "ill" ilk (a generic one similar to {{ill}}, and a bunch of specific ones to link to specific wikis, e.g. "אנ" (= en) to link to enwiki and similar templates for links to dewiki, eswiki, ruwiki, frwiki and dozens more).
this module tests for 3 types of common errors:
  • link to non-existent page on foreign wiki.
  • link to article where local one exists (similar to the maintenance cat. you linked to)
  • link to disambiguation article (this is almost always a mistake)
it is solely based on WD, so there may be glitches: for instance, it can happen that the page exists, but has no WD item, and there are both false positive and false negative in identifying disambiguations. to overcome this, we recognize optional "pardon" parameters saying "in this case it's not an error" (one such param for each of the error conditions).
this module populated 3 maint. categories with many thousands of articles, and busy wikignomes have corrected most of them already, and i expect these cats will empty soon.
the module is here: He:Module:קישורים לוויקיפדיות זרות - easy read, 150 lines.
the categories and error message names are in hebrew (sorry), but i tried to put all the language-dependent stuff in constants at the top so it can be (relatively) easily be used by other wikis.
(
note: the "complain()" func uses a different module, which does something similar to Module:Check for unknown parameters, except "ours" is based on the template's templatedata, and does much more thorough work (e.g., checks for missing "required" params and more. you may want to gleam he:Module:ParamValidator. actual code is some 260 lines). this module not only adds maint. categories, it also provides a convenient way for editors to pinpoint the rebellious template in the page, to assist gnomes in fixing them, and the new "ill sanitizer" module piggybacks on this method.
)
thanks again, everyone.
peace. קיפודנחש (aka kipod) (talk) 18:07, 1 July 2026 (UTC)Reply

Edit request for consideration

[edit]

Made an edit request at MediaWiki talk:Scribunto-common-error-category to split up that category a bit more to create Category:Articles with script errors so we can isolate just articles and clean those up. Will always be sandboxes and testcases with errors so would be helpful to be able to isolate the article errors. Zackmann (Talk to me/What I been doing) 16:54, 1 July 2026 (UTC)Reply

FWIW, CategoryTree can be used to discriminate against category members based on namespace, and it's possible to use it on the category page.
following will show the members in article space only (i saw a link to petscan on the cat page, but did not see one using categorytree):
{{#categorytree:Category:Pages with script errors|namespaces=0|depth=0}}
generates:
(notice: the link will open the whole category, the little triangle on the left will show those in mainspace. as of now, there are none, so to demonstrate it actually works, i'll add the same for portal:
as to the request itself: i think you were misguided when told to come here. this is not a scribuntu issue - you are asking to edit a "system message" in mediawiki space, and sysop or interface admin permission is required. i am not an enwiki native so i may misdirect you even further, but i'd try WP:ANI or WP:IAN.
peace. קיפודנחש (aka kipod) (talk) 22:30, 1 July 2026 (UTC)Reply
It's the tracking category for lua errors, so is relevant to this page. I think it was just for information rather than asking for help with the edit request  Martin (MSGJ · talk) 07:41, 2 July 2026 (UTC)Reply
it's an edit request.
since it's for for a system message. I tried to point to the appropriate place for this request.
again, i'm not an enwiki native, so if there's a better place, please let OP know.
peace. קיפודנחש (aka kipod) (talk) 12:40, 2 July 2026 (UTC)Reply
ooops - sorry. did not realize @MSGJ is an admin (or interface admin?) who can (and did) do the deed...
peace. קיפודנחש (aka kipod) (talk) 12:44, 2 July 2026 (UTC)Reply