Currently, an interwiki link like this:
[[wiktionary:de:Kopf]]
is expanded in the HTML output as:
http://en.wiktionary.org/wiki/de:Kopf
The server at en.wiktionary.org has special code that redirects a request for this URL to:
http://de.wiktionary.org/wiki/Kopf
This is a clever hack, and we've been using it for a long time. I wonder, however, if we can make interwiki links render correctly in the output in the first place. This would save an unnecessary hit on the server.
Our default interwiki table maps "wiktionary" to "http://en.wiktionary.org/wiki/$1". I think we could have the URL pattern include a second argument, the language code, at $2, like so: "http://$2.wiktionary.org/wiki/$1".
Note that this will only work if every language version of a project has URLs matching this pattern. I think this is the case for all Wikimedia projects, but someone correct me if I'm wrong.
The code in Title::getFullURL that creates an interwiki URL could work as follows:
if (the interwiki url pattern doesn't have a '$2' in it) { substitute the title text for $1 in the interwiki URL pattern; } else if (the title text has a colon AND the part before the first colon is a language code) { substitute the part after the first colon for $1, and the part before the first colon for $2, in the interwiki URL pattern; } else { substitute the title text for $1, and the current content language code for $2, in the interwiki URL pattern; }
If there's no objection, I'm going to go ahead and make this change.
~Evan
________________________________________________________________________ Evan Prodromou evan@prodromou.name http://evan.prodromou.name/