Last modified: 2014-09-24 01:22:06 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T3433, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 1433 - Add metainformation to pages with interlanguage links
Add metainformation to pages with interlanguage links
Status: REOPENED
Product: MediaWiki
Classification: Unclassified
Interface (Other open bugs)
1.4.x
All All
: Low enhancement with 2 votes (vote)
: ---
Assigned To: Nobody - You can work on this!
http://www.w3.org/TR/2004/WD-xhtml2-2...
: patch, patch-reviewed
: 32725 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2005-01-30 09:00 UTC by Anders Wegge Jakobsen
Modified: 2014-09-24 01:22 UTC (History)
10 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
The patch as an attachment (2.00 KB, patch)
2005-01-30 09:02 UTC, Anders Wegge Jakobsen
Details
Patch updated to apply to trunk as of r25921 (1.48 KB, patch)
2007-09-18 20:48 UTC, Brion Vibber
Details
Alternate version of patch with HTML 4.01-compatible link info (1.61 KB, patch)
2007-09-18 20:52 UTC, Brion Vibber
Details
Patch adds rel=alternate and languages onto links. (1.30 KB, patch)
2009-03-04 05:47 UTC, Andrew Garrett
Details

Description Anders Wegge Jakobsen 2005-01-30 09:00:46 UTC
This patch adds xml:lang links, as described in 
http://www.w3.org/TR/2004/WD-xhtml2-20040722/mod-meta.html#sec_20.5.2. to all
pages with interlanguage links. A diff against the current (2005-jan-30 09:00
UTC) CVS REL1_4 is attached. The results can be seen in the source for the two
pages http://playwiki.wegge.dk/MediaWiki and
http://wiki.wegge.dk/MediaWiki_customizations 

Diff against current code:

--- Programming/MediaWiki/REL1_4/includes/SkinTemplate.php	2005-01-30
09:21:07.976778061 +0100
+++ playwiki/includes/SkinTemplate.php	2005-01-30 09:42:07.552766175 +0100
@@ -328,7 +328,8 @@ class SkinTemplate extends Skin {
 			$nt = Title::newFromText( $l );
 			$language_urls[] = array('href' => $nt->getFullURL(),
 			'text' => ($wgContLang->getLanguageName( $nt->getInterwiki()) !=
''?$wgContLang->getLanguageName( $nt->getInterwiki()) : $l),
-			'class' => $wgContLang->isRTL() ? 'rtl' : 'ltr');
+			'class' => $wgContLang->isRTL() ? 'rtl' : 'ltr',
+                        'language_code' => $nt->getInterwiki());
 		}
 		if(count($language_urls)) {
 			$tpl->setRef( 'language_urls', $language_urls);
diff -rup -xCVS Programming/MediaWiki/REL1_4/skins/MonoBook.php
playwiki/skins/MonoBook.php
--- Programming/MediaWiki/REL1_4/skins/MonoBook.php	2005-01-22
22:45:48.000000000 +0100
+++ playwiki/skins/MonoBook.php	2005-01-30 09:51:16.091509526 +0100
@@ -60,7 +60,13 @@ class MonoBookTemplate extends QuickTemp
     <?php if($this->data['usercss'   ]) { ?><style type="text/css"><?php      
       $this->html('usercss'   ) ?></style><?php    } ?>
     <?php if($this->data['userjs'    ]) { ?><script type="text/javascript"
src="<?php $this->text('userjs'    ) ?>"></script><?php } ?>
     <?php if($this->data['userjsprev']) { ?><script
type="text/javascript"><?php      $this->html('userjsprev') ?></script><?php   } ?>
-  </head>
+    <?php if( $this->data['language_urls'] )
{foreach($this->data['language_urls'] as $langlink) { ?>
+    <link title="<?php echo $langlink['text'] ?> version"
+          rel="alternate"
+          xml:lang="<?php echo $langlink['language_code'] ?>"
+          resource="<?php echo $langlink['href'] ?>" />
+       <?php } } ?>
+</head>
   <body <?php if($this->data['body_ondblclick']) { ?>ondblclick="<?php
$this->text('body_ondblclick') ?>"<?php } ?>
         <?php if($this->data['nsclass'        ]) { ?>class="<?php     
$this->text('nsclass')         ?>"<?php } ?>>
     <div id="globalWrapper">
Comment 1 Anders Wegge Jakobsen 2005-01-30 09:02:01 UTC
Created attachment 239 [details]
The patch as an attachment
Comment 2 Brion Vibber 2007-09-18 20:48:01 UTC
Created attachment 4130 [details]
Patch updated to apply to trunk as of r25921
Comment 3 Brion Vibber 2007-09-18 20:52:07 UTC
Created attachment 4131 [details]
Alternate version of patch with HTML 4.01-compatible link info

The original version of the patch uses <link> attributes recommended in an XHTML 2 draft spec, but these don't seem to be seen by existing user agents.

This alternate patch uses lang, hreflang, and href instead of xml:lang and resource attributes, matching HTML 4.01 recommendations.

I can confirm that the language alternates are listed in Seamonkey's navigation bar if activated and by lynx.

Note that this may actually annoy lynx users, as does the existing OpenSearch description link, but that's because lynx is kind of bad about putting these supplementary links in totally the wrong place. :P

This version of the patch also applies proper HTML escaping...

The hardcoded English string 'version' in the title is probably not too super.
Comment 4 Brion Vibber 2009-01-23 01:40:45 UTC
Rather than hardcoding this into MonoBook.php, this should probably be done in a skin-independent way, pumping entries into the list of header links on OutputPage which will get used by any skin.

Note also bug 4901, for adding lang attribs to the clickable interlanguage links.
Comment 5 Andrew Garrett 2009-01-23 02:24:53 UTC
Fixed up in r46059, with a completely different patch.
Comment 6 Danny B. 2009-01-23 04:40:36 UTC
Reopening per comments on r46059.
Comment 7 Brion Vibber 2009-01-26 21:49:27 UTC
Would someone like to test the rel="alternate" on the inline <a href>s and confirm whether it seems to work? If working, they should show up in the navigation bar when enabled in SeaMonkey.
Comment 8 Melancholie 2009-01-27 05:18:17 UTC
SeaMonkey and "Firefox + Site navigation bar extension" do show this, yes.
[More]
L [Other Versions]

Opera doesn't seem to provide [More], nor [Documents]; so Opera doesn't show this (at least not by default).
Comment 9 Aryeh Gregor (not reading bugmail, please e-mail directly) 2009-01-27 23:12:49 UTC
Putting the rel= on the language link certainly seems like the correct thing here.  I don't think we need an extra fifty million <link>s just for the sake of Opera.
Comment 10 Melancholie 2009-01-28 00:14:58 UTC
Note: I tried this at Betawiki (r46385), and there it's *not* in the <a href=""> link but in a <link>.
Will it work properly in href-links too?

----
By the way: You could turn around title and rel in <link title="..." rel="alternate" (for uniformity with the other <link> tags).
Comment 11 Aryeh Gregor (not reading bugmail, please e-mail directly) 2009-01-28 00:38:45 UTC
(In reply to comment #10)
> Will it work properly in href-links too?

The semantics are the same, per the standards.  I don't know if all user-agents will treat them the same.  If any don't, that's probably a bug on their part.
Comment 12 Andrew Garrett 2009-03-04 05:47:56 UTC
Created attachment 5883 [details]
Patch adds rel=alternate and languages onto links.

This patch doesn't seem to trigger the appropriate mechanisms in SeaMonkey.
Comment 13 Aryeh Gregor (not reading bugmail, please e-mail directly) 2009-03-04 10:00:01 UTC
+	title="<?php echo $langlink['text'];?>"

Doesn't this just repeat the text of the link?  Why is it necessary?  Also, doesn't it need to be htmlspecialchars()ed?  (I don't think anyone's come up with a language called Bjegka"fka0###&@!! yet, but it's probably just a matter of time.)

+	lang="<?php echo $langlink['interwiki'];?>"
+	hreflang="<?php echo $langlink['interwiki'];?>"
+	xml:lang="<?php echo $langlink['interwiki'];?>"

Okay, that's just *excessive*.  Only one of these should be needed.  Or maybe two, if you really think it's important to mark up the fact that the word is in the same language as its target.  We don't mark up different languages anywhere else in the interface, is there any good reason for it?  It's going to add up to quite a lot of extra markup clutter on large articles . . .
Comment 14 Andrew Garrett 2009-03-04 11:31:19 UTC
(In reply to comment #13)
> +       title="<?php echo $langlink['text'];?>"
> 
> Doesn't this just repeat the text of the link?  Why is it necessary?  Also,
> doesn't it need to be htmlspecialchars()ed?  (I don't think anyone's come up
> with a language called Bjegka"fka0###&@!! yet, but it's probably just a matter
> of time.)

Ahem. I am far too used to having abstraction libraries.
Comment 15 Sumana Harihareswara 2011-11-06 14:15:32 UTC
Andrew, am I right in seeing that Aryeh did review your patch?
Comment 16 Mark A. Hershberger 2011-11-30 20:24:49 UTC
*** Bug 32725 has been marked as a duplicate of this bug. ***
Comment 17 matanya 2012-07-26 14:05:17 UTC
Did this patch get merged?

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links