Template talk:Interlanguage link

Active discussions

Why doesn't this work?Edit

Why does this work

Hooglede town hall [nl]

and this not work, displaying "Trève" instead of "trèves"?

Trève [fr]

I'm sure it's simple, I just need another pair of eyes. Maproom (talk) 10:24, 6 August 2020 (UTC)

You might not be reading the documentation correctly. In the second case it is linking to Trève here and to fr:trèves at the French Wikipedia. Johnuniq (talk) 10:37, 6 August 2020 (UTC)
fr:Trèves is a disambiguation page; which Trèves do you want to link to? Or do you mean fr:Trève? -- Michael Bednarek (talk) 11:00, 6 August 2020 (UTC)
I want to link to fr:Trève, but to have the result appear lower-case and plural. I could do it like this: trèves. But I thought that the use of interlanguge links was encouraged, and the :fr: stuff deprecated. Maproom (talk) 11:22, 6 August 2020 (UTC)
It's simple, first parameter the name you want in English, second para the two-letter language code, third para name in that language (only needed if different from name in English), and then comes what you need when it should show differently from name in English, |lt= (short for link text, so here ill Trève fr lt=trèves, trèves [fr].
Just insert "lt=" before the name to be shown. All this should be in he documentation. --Gerda Arendt (talk) 11:31, 6 August 2020 (UTC)
Ok, I see one of my mistakes now, I had "Trève" and "trèves" the wrong way round. Let's try these trèves, Trève, trèves [Trève]. No, none of them works. I'll stick with trèves. Maproom (talk) 11:47, 6 August 2020 (UTC)
Don't know. First and most important question: what should the English article name be, Trèves (WHAT)? It needs some dab, somthing in brackets describing what this meaning is. Or an English word. I don't speak French, sorry. --Gerda Arendt (talk) 11:54, 6 August 2020 (UTC)
You can force the link with |display=1, so {{ill|trèves|fr|Trève|display=1}} becomes trèves [fr]. Primefac (talk) 12:29, 6 August 2020 (UTC)

Expensive parser functionEdit

Pages like List of villages in Rivne Oblast (as of 22:45, 25 September 2019 ) that call this many times may exceed Wikipedia's limit of 500 "expensive parser functions."

For example, the call to {{ill|Vychivka|uk|Вичівка}} will count as one "expensive parser function."

I don't know WHY this works, but I have determined that changing the lines to {{ill|Vychivka{{!}}Vychivka|uk|Вичівка}} by simply adding {{!}} followed by a repetition of the name of the English-language page will eliminate the expensive parser function.

However, there may be good reasons NOT to do this, besides the obvious one of it being confusing to editors, causing many to say "This looks redundant, let me take out the {{!}}..." and unintentionally "un-fixing" the problem.

Anyone have any ideas on ways to cut down on the number of expensive parser function calls? Anyone understand this template well enough to add "if you call this template this way ... you will cost one 'expensive parser function' call, consider doing it this way ... instead" to the documentation page?

I also added {{expensive}} to the template's documentation page. davidwr/(talk)/(contribs) 17:59, 14 August 2020 (UTC)

The correct way to handle this is by painfully fixing the links. Some links will now exist as articles at enwiki, so the {{ill}} can be replaced with a normal wikilink. Some links might not exist at enwiki or ukwiki, so {{ill}} could be replaced with no link. A gigantic example of the former is explained here. I asked why your trick works here. Johnuniq (talk) 00:17, 15 August 2020 (UTC)
For the record, I'll note that the answer from Jackmcbarn was that #ifexist starts by noting that its parameter contains a character ("|") that is not valid in a title, so it returns false without bothering to check if the page exists. Johnuniq (talk) 23:55, 15 August 2020 (UTC)

Edit request to reduce expensive parser function callsEdit

Please review and add this Sandbox diff to the template.

The goal is to eliminate the expensive parser function calls to #ifexists and the expensive call within #invoke:redirect|isRedirect in situations where we know we don't care, namely, when |display= or |preserve= are set to any value.

Primary use case: In "list-type" articles, there is already an advantage to using |display=1 (or any non-blank value) to preserve the inter-wiki links for pages that have an article in the English Wikipedia. These same types of articles are the type that are likely to exceed Wikipedia's 500-limit for expensive parser function calls. The "driving example" is List of villages in Rivne Oblast (discussion).

I've updated the testcases for this template. Here is a version that shows that, with the change, there are no expensive parser function calls with |display=1 or |preserve=1.

Additional testing of the underlying change can be found at my sandbox as of 20:18 15 August 2020 and the testcases for it at my sandbox2 as of 17:20 15 August 2020.

Once this is done, please "ping" me and I will update List of villages in Rivne Oblast. davidwr/(talk)/(contribs) 20:53, 15 August 2020 (UTC)

@Jackmcbarn: Would you mind having a look at this request. Johnuniq (talk) 23:51, 15 August 2020 (UTC)
  Done Yep, that's exactly what was needed to properly fix this. (By the way, this template is crying to be converted to Lua. I might do that at some point now that I see what a mess it is.) Jackmcbarn (talk) 00:33, 16 August 2020 (UTC)
Thank you. I've updated List of villages in Rivne Oblast. It no longer "breaks the Wiki." davidwr/(talk)/(contribs) 01:18, 16 August 2020 (UTC)

Forcing redlink on redirect pagesEdit

Is there a way to add an option that makes the English link redlinked (and preferably wrapped in Template:No redirect) if the article on English Wikipedia is a redirect? The main use case for this when trying to avoid circular redirects. Jumpytoo Talk 03:13, 30 August 2020 (UTC)

  • In a word, no. If it is a redlink, it will show as a redlink. If it's a redirect, it will show as a normal link (unless you have a link classifier, so for example mine shows up green). But, remember that if it is a redirect it will still show the interwiki links, indicating that it is a redirect. Primefac (talk) 12:09, 30 August 2020 (UTC)
    • @Primefac: I've also got a similar issue at Hololive Production#Talents. Where ILL is used, some are red and some are blue, but every blue link is a circular redirect. This makes it quite counterintuitive, especially when there is one list entry (Hoshimachi Suisei) where an article does exist in English. Is there any way to make this template surpress linking only when it's circular?  Ganbaruby! (Say hi!) 16:36, 25 October 2020 (UTC)
      • You can't force a literal red-link unless you add some sort of disambiguator. In other words, if you don't want Sakura Miko [ja] to be blue, then change it to something like Sakura Miko [ja] (note it's linking to Sakura Miko (VTuber)). The downside, of course, is that you end up with an unnecessary dab and thus won't know if/when the actual Sakura Miko page has been created. Primefac (talk) 17:03, 25 October 2020 (UTC)
  • @Ganbaruby: As Primefac said, you can't make the link red, but you can do the next best thing - turn it black or suppress the redirect. I gave it a go and it's harder than it looks unless you want to have yet another expensive parser function call. Here are several approaches to take. Each involves having a new parameter |suppressredirects=. In each case, change the code so if "suppressredirects" is set, do the following:
  • Rewrite it as a module or module-based template. This may be the best approach.
  • Re-factor it so the check for {{#ifexist:{{{1|}}}|{{#invoke:redirect|isRedirect|{{{1|}}}}}|1}}}} happens earlier and it "wraps" the rest of the logic. Note that this code returns "1" if the page |1= does not exist, "yes" if it is redirect, and nothing if it is a non-redirect page. I looked at this option and it's pretty involved, more than I can do in an hour. I think it will also result in duplicate code, which makes maintenance a problem.
  • Bite the "expensive parser function" bullet and do that check twice, once where it's currently being checked, and once earlier, before where the en-wiki link is printed. Something like this might work (NOT TESTED!): {{#if:{{{suppressredirects|}}}| code to check for a redirect and if it is one, make the link look like we want }} existing code to display the link {{#if:{{{suppressredirects|}}}| more code check for a redirect and if it is one, make the link look like we want }}. This would be at least two expensive parser functions. To save on an expensive parser function call, I recommend using this in conjunction with |display= and possibly modifying the code above.
In any of these cases, my recommendation would be to surround the en-wiki link with {{noredirect|...}} if - and only if - the file exists.
As I am writing this, I have an idea but I need to wait until later today to try it out. If it works, you will be able to do what you want without any additional expensive parser function calls or duplicate code. davidwr/(talk)/(contribs) 18:19, 25 October 2020 (UTC)
  • @Ganbaruby: I put some alpha-state code in the sandbox, it implements |suppressredirect= which will wrap links with {{noredirect|{{{1}}}|{{{lt}}}}}. |lt= is optional. It's not "red" but at least it keeps the circular redirects at bay. I did notice that Module:redirect has a way of determining the target of the redirect. This means in principle, you could write a version that would check to see if the target was the current page and if so, do something special. Temporary documentation including a to-do list are in html comments at the top. Parser profile test results are in an older edit, clearly labeled in the edit history. I've also added half a dozen testcases.
TO DO LIST: (any volunteers?)
  • Have someone who knows safesubst: go through and add it where needed and check it where it's already there.
  • Have another experienced template editor review the new code closely, both for errors and opportunities to make it more efficient.
davidwr/(talk)/(contribs) 21:17, 25 October 2020 (UTC)
  • @Jumpytoo: I changed the sandbox code so I think it meets your needs. I took out the just-added support for |suppressredirect= and replaced it with a new parameter, |useredirect=. If you use it, the target of the redirect will be the wikilink. You can still "mask" it with the existing parameter |lt=. I'm going to add another parameter called |maskredirect= which, if set, will cause |1= to be used as the "wikilink mask" if |lt= is not set. davidwr/(talk)/(contribs) 00:31, 26 October 2020 (UTC)
Thanks, I've played around with it and I'm not sure how to achieve the red/no redirect effect with the new params. Is there an example you can show? Jumpytoo Talk 01:34, 26 October 2020 (UTC)
  • @Jumpytoo and Ganbaruby: Template:Interlanguage link/sandbox is "stable" (permalink) at least I don't PLAN on making changes to it for the next 10 hours at least, it's got preliminary documentation in html comments at the top. I made this test revision, since reverted, of Hololive Productions. You can see in the collapsed tables in the "Talents" section that redirects are in bold black, but still show the name used by the editor. This is done by a combination of the new |useredirect=1 and |maskredirect=1 parameters.
This change is not ready to be merged yet. Besides getting agreement if this functionality is wanted, there is a technical TO DO LIST:
  • Make sure it can be safely substituted. I am not experienced in this area so I didn't try hard to get it right.
  • Have a code review by someone experienced with templates. I've been mistake-prone today so to be blunt, I don't trust my own work today.
  • Make sure when the new parameters are NOT used, the parser profiling usage is about the same as the existing version. In other words, no surprised with template post expansion include size, parser function count, etc. etc.
davidwr/(talk)/(contribs) 02:04, 26 October 2020 (UTC)
@Jumpytoo and Ganbaruby: Do either of you want this enough to go forward with adding |useredirect=1 and |maskredirect=1? If not, I'll drop it as "not needed now, let's keep things the way they are until there is a need."
@all: If either of them answer yes, I need one or more volunteers who knows how to make substitution safe to proofread this and fix it up. Once it's been fixed and checked, we can go live, but only if there is a current need for this. davidwr/(talk)/(contribs) 23:01, 26 October 2020 (UTC)
I am still supportive of this feature. While I am fine with the feature as is, looking into if it's possible to add CSS + no-redirect link would be appreciated. Also, is there a use case for only using one of the params and not the other? Jumpytoo Talk 01:27, 27 October 2020 (UTC)
@Davidwr: Thanks for the hard work. I like it! Couple things: in an instance of a circular redirect, is there any way for the link to not be bolded when useredirect is set? Also, is there any reason why someone would have useredirect but not maskredirect?  Ganbaruby! (Say hi!) 11:38, 27 October 2020 (UTC)
@Jumpytoo and Ganbaruby: Wikimedia software turns a link to the current page into a non-clickable bold link: [[Template talk:Interlanguage link|Template talk:ill]] renders as Template talk:ill. There is a "cheat" which is to replace the link with the URL version, something like [{{canonicalurl:Template talk:Interlanguage link}} Template talk:ill}}] renders as Template talk:ill. As for use cases, there are use cases for just useredirect without maskredirect but on reflection, they are probably uncommon. It might be worth "reversing the logic" so |maskredirect= is replaced with |exposeredirect=, so by default |1= is what the person sees by default when |useredirect= is used. Thoughts? davidwr/(talk)/(contribs) 12:57, 27 October 2020 (UTC)
@Davidwr: I read the above discussion and tried out the new parameters, but I am still confused.
In the specific case of Tokino Sora [ja] at Hololive Production#Talents, is there a way to make the display look exactly like Tokino Sora [ja] (with a non-clickable, non-bold display)? I think Tokino Sora [ja] is an undesirable result, and would like to avoid it unless there is a technical/intentional reason against it. — Goszei (talk) 22:02, 20 November 2020 (UTC)
@Goszei: The bold comes from the fact that the wikilink is actually to the current page. That is, tokino Sora redirects to Hololive Production. If you want "no bold, no click, no color" behavior, the sandboxed version will need to be changed to specifically check to see if the redirect target is the current page, then NOT put in a wikilink. That could get complicated, but it's certainly do-able. davidwr/(talk)/(contribs) 22:12, 20 November 2020 (UTC)
@Davidwr: I personally support such a feature. — Goszei (talk) 22:16, 20 November 2020 (UTC)
If you don't want a link, don't put a link, just put a {{small|{{bracket|[[ja:ときのそら|ja]]}}}} after the name, which will give you your [ja]. Primefac (talk) 22:19, 20 November 2020 (UTC)
Courtesy ping to @Kanashimi: The changes being discussed above will not be "breaking changes" (well, not if done properly), so they should not affect Cewbot, but you might want to at least skim the discussion and see the html comments at the top of the sandbox. If you see any potential problems, please jump in so we don't break anything. davidwr/(talk)/(contribs) 22:47, 20 November 2020 (UTC)
Thank you for reminding. It is OK, the bot only parse the parameters and will not care the CSS or HTML codes. --Kanashimi (talk) 23:53, 20 November 2020 (UTC)

Use CSS?Edit

You could give this template a TemplateStyle (CSS) subpage containing a.mw-redirect { color: WHATEVER; }. But this rule will actually "leak out" and affect other ("normal") redirects elsewhere on the page where the template is used (I just tested this on a localhost wiki). That can be avoided by wrapping the entire template output in something like <span class="ill">...</span> and using more specific CSS like span.ill a.mw-redirect { color: whatever; } to only affect redirect links inside such a span.

Note that any color selection here will probably annoy users who've added their own CSS and therefore expect all redirects to be the same color of their own choosing, regardless of whether they're formed [[Like this]] or {{ill|Like this|es|Como esto}}. Such users would need to opt out by adding another line in their CSS to override this new (more specific) rule to also use color they like, or by adding !important to their existing (less specific) rule. This should be explained in the docs if we do it.

The above caveats aside, perhaps some shade of purple would make the most sense? ―cobaltcigs 11:15, 26 October 2020 (UTC)

Related user scriptEdit

I've developed a script which finds red link titles on the page the user is editing, searches for them on wikidata, prompts the user to choose the correct wikidata item (if any), then changes each red link to an instance of {{ill}}, populated with interlanguage prefixes/titles fetched from the selected wikidata item. Testing/feedback is welcome. ―cobaltcigs 09:41, 3 October 2020 (UTC)

How to initiate the script? I have just add it to my common.js and Bypassed my cache, but nothing happened.Jklamo (talk) 23:08, 5 October 2020 (UTC)
While editing a page you should see a new tab titled "ill", clicking on which should display a table of links in place of the editing textbox. If using the vector skin (never recommended), this may be hidden in the "more" menu. ―cobaltcigs 00:29, 9 October 2020 (UTC)

Improve syntaxEdit

Could the syntax be improved so that the sitelinks on Wikidata are used to provide the correct links? In other words

{{Interlanguage link|WD=Q3588672|es|fr}}

would produce Émile Morlaix [es; fr] preferably with the link to Émile Morlaix (Q3588672) too? — Martin (MSGJ · talk) 13:03, 8 October 2020 (UTC)

Gotta look into the code for a second, but the coded text above gives es [Wikidata]. With {{Interlanguage link|Émile Morlaix|es||fr|WD=Q3588672}} you get Émile Morlaix [Wikidata]. Primefac (talk) 18:24, 8 October 2020 (UTC)
Okay, looked at the code, and the archives, and I feel like the primary purpose of the WD links was if there weren't other languages (which I somewhat mangle in this discussion but I can't find what I was looking for). Basically, I would think that if there are 1-2 links to other languages, we don't really need to have a link to WD in addition to that.
So... to answer the original question, yes it can be done. To ask a follow-up question, do we want this to be done? Primefac (talk) 18:50, 8 October 2020 (UTC)
Existing behavior should remain unchanged, but the new behavior would be desirable as well. I recommend adding a new parameter |WDget= with values of |WDget=basic which would be the same as no WDget parameter at all i.e. the current behavior, |WDget=wikipedias which would show all of the Wikipedia language links in the same order they are in WikiData, and |WDget=both which would do both.
The end result would look something like this: {{Interlanguage link|Émile Morlaix|WD=Q3588672|WDget=both}} -> Émile Morlaix [Wikidata; es; fr]. davidwr/(talk)/(contribs) 20:14, 8 October 2020 (UTC)
That was previously discussed (see the discussion I linked above), and it was decided not to import WikiData information directly. Primefac (talk) 20:31, 8 October 2020 (UTC)
Proposal - a separate, always-subst'd template that generated a list of parameters based on what is in WikiData at the moment it is used. For |1=Q3588672 this new template would generate es|Émile Morlaix|fr|Émile Morlaix. This way, I could just do
{{Interlanguage link |Émile Morlaix |{{subst:newtemplatenamegoeshere |Q3588672}}}}
and know that the current list from WikiData would be imported, but that it would be immune from being hijacked by future WikiData edits. As an alternative to the Q entry, this new template should allow the name of an English or other-language Wikipedia entry that actually exists, such as
{{Interlanguage link |Émile Morlaix |{{subst:newtemplatenamegoeshere |es:Émile Morlaix}}}}
davidwr/(talk)/(contribs) 20:55, 8 October 2020 (UTC)
This has the potential, which was discussed in the previous discussion, to result in a dozen different interwikis being linked. I'm not strictly opposed to this idea, but I feel like it's going to be way more hassle than it's worth, just for the minor benefit of catching random languages like vi or sr. Primefac (talk) 21:14, 8 October 2020 (UTC)
Back to the original proposal: How about if the template uses a "snapshot in time" version of WikiData, so
{{Interlanguage link|WD=Q3588672|es|fr|UseWD=1}}
self-substitutes and renders as
{{Interlanguage link|es|Émile Morlaix|fr|Émile Morlaix}}
This would make it much easier on all editors, as they wouldn't have to look up the page name, but it would not have the problems of "a bunch of language links" or the problem of the language link changing out from under them if someone vandalized WikiData. Editors would need to be reminded to check their edit though, just to be sure WikiData wasn't vandalized 0.1 seconds before the editor published the edit on the English Wikipedia.
If self-substitution is too hard, maybe a new template called {{interlanguage link2}} can be written which MUST be substituted, resulting in a conventional use of the current {{interlanguage link}}.
For situations where there is already an English-language page and the non-English version is desired as well (e.g. with redirects or when |display= or |preserve= are used), the |WD= parameter would be optional, if it is missing, the English page name would be used to get the WikiData entry. davidwr/(talk)/(contribs) 22:03, 8 October 2020 (UTC)
I'd like to see the above-described functionality added, but have no faith in that ever happening. That's why I created a user script to expedite the otherwise tedious process of searching wikidata.org for a title, identifying the correct wikidata item from potentially numerous choices, collecting the foreign-language prefixes and titles from that Q-number page, populating these into an {{ill}} template call, and inserting that code in place of a regular red link. All without opening a dozen tabs or displacing something important from your system clipboard. See previous section.
This is, of course, an imperfect workaround because unlike a "live" Q-number lookup, it will not update itself when new language entries are added. Such updates would be a suitable bot task, once the initial (and necessarily human) identification of the correct item has been done.
Note that "showing too many language links" after a red link isn't a problem in itself; it's just a rather embarrassing symptom of allowing enwiki to fall behind that many other-language wikis. In the credits of foreign film stubs, I commonly find red links on enwiki where 4–5 other wikis have a bio. Such omissions really should be made as glaring as possible, to encourage somebody fluent in one of these languages to translate at least a stub for us locally. That is, by far, the most constructive way to make a ghastly list of language codes go away.
De-linking to plain text is the absolute worst, but (frustratingly) some users do that too.
cobaltcigs 20:21, 25 October 2020 (UTC)

Cewbot cleaning out ill linksEdit

You might be interested in the following discussion:

User talk:Kanashimi#Task 1 Convert interlanguage link templates with local article to wikilinks

CapnZapp (talk) 11:32, 25 October 2020 (UTC)

Template:Wikidata red linkEdit

{{Wikidata red link}} is a fairly new template with similar functionality with respect to Wikidata. It doesn't have the inter-lanaguage linking that that {{interlanguage link}} has, but there is enough overlap that a merger should be considered.

If nothing else, when and if either template is rewritten as a module, that might be a good time to "do the merger." davidwr/(talk)/(contribs) 22:56, 25 October 2020 (UTC)

CategoryEdit

It took me a while to find this template. I knew I had seen it in use bout could not find it. Should it be in Category:Language templates? --Error (talk) 13:13, 18 November 2020 (UTC)

Return to "Interlanguage link" page.