r46059 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r46058‎ | r46059 | r46060 >
Date:02:11, 23 January 2009
Author:werdna
Status:reverted (Comments)
Tags:
Comment:
(bug 1433) Add meta-information to pages with language links.
Modified paths:
  • /trunk/phase3/includes/OutputPage.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/OutputPage.php
@@ -1541,6 +1541,20 @@
15421542 $tags[] = Xml::element( 'link', $tag );
15431543 }
15441544
 1545+ // Language Links
 1546+ global $wgContLang;
 1547+ $langLinks = $this->getLanguageLinks();
 1548+ foreach( $langLinks as $link ) {
 1549+ $t = Title::newFromText( $link );
 1550+ $tags[] = Xml::element( 'link', array(
 1551+ 'title' => wfMsg( 'language-link-title', $wgContLang->getLanguageName( $t->getInterwiki() ) ),
 1552+ 'rel' => 'alternate',
 1553+ 'lang' => $t->getInterwiki(),
 1554+ 'hreflang' => $t->getInterwiki(),
 1555+ 'href' => $t->getFullURL()
 1556+ ) );
 1557+ }
 1558+
15451559 if( $wgFeed ) {
15461560 global $wgTitle;
15471561 foreach( $this->getSyndicationLinks() as $format => $link ) {
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -3791,4 +3791,5 @@
37923792
37933793 #Put all regex fragments above this line. Leave this line exactly as it is</pre>',
37943794
 3795+'language-link-title' => '$1 version',
37953796 );

Follow-up revisions

RevisionCommit summaryAuthorDate
r46067* Follow up r46059: Add new message...raymond07:36, 23 January 2009
r46397Roll back r46059, r46062 "(bug 1433) Add meta-information to pages with langu...brion23:08, 27 January 2009
r46399revert r46067 also "* Follow up r46059: Add new message"brion23:10, 27 January 2009

Comments

#Comment by 😂 (talk | contribs)   03:34, 23 January 2009

Couldn't this get excessive on pages that have a lot of interlanguage links? Some articles easily have 50+, which could make the source a lot lot longer.

#Comment by Danny B. (talk | contribs)   04:39, 23 January 2009

Basically, the interwiki link itself (I mean the <a>) should have the rel and other language-based attributes as hereby featured <link> has.

Then we could simply check the browsers' behavior and in case those <a> will be treated the same as <link> (eg. an item in (sub)menu), then it might be removed as duplicity.

Or even better way would be to have user preference "Include <link>s to alternate versions / versions in other languages" - some people would utilize these tags, some wouldn't, some prefer as shortest output as possible.

#Comment by Werdna (talk | contribs)   04:49, 23 January 2009

"Then we could simply check the browsers' behavior and in case those <a> will be treated the same as <link> (eg. an item in (sub)menu), then it might be removed as duplicity. "

No, this won't work. We're talking about a <link rel="alternate">, which means "An alternate version of the same page is available at this URL". Adding the same attributes to the <a> tags simply tells the browser what language the target of those links is in, without assigning any semantic (GET HIM!) value to the target of the links.

"Or even better way would be to have user preference "Include <link>s to alternate versions / versions in other languages" - some people would utilize these tags, some wouldn't, some prefer as shortest output as possible. "

No, it wouldn't be better. 99% of our users don't care, and we shouldn't bother them with a preference so deeply-embedded in implementation details. Even in the a bad, when we have 100 or so interwiki links, the <link> objects shouldn't add more than 10 or 20 kB to the size of the HTML, which is at most a doubling of size. Downloads on web sites are dominated by images, auxiliary files such as CSS/JS and latency. A few kB on large articles is not a big deal.

#Comment by Danny B. (talk | contribs)   14:52, 23 January 2009

"No, this won't work. We're talking about a <link rel="alternate">, which means "An alternate version of the same page is available at this URL". Adding the same attributes to the <a> tags simply tells the browser what language the target of those links is in, without assigning any semantic (GET HIM!) value to the target of the links."

Of course I've got him: <li class="interwiki-_lang_"><a href="_url_" rel="alternate" hreflang="_lang_" lang="_lang_" xml:lang="_lang_" title="_target_page_name_">_language_name_</a></li>.

"A few kB on large articles is not a big deal."

Unless you use dial-up or cellphone connection, unless you use mobile browsers, unless you pay for transferred data etc. etc... Not everybody uses T3-like fast connections for 99 cents a month with unlimited data transfer.

Think about countries where internet infrastructure is very premature, think about cell phone providers which tax every started 10 kB etc. And nevertheless think about the time to load on (not only) slow connections.

"Downloads on web sites are dominated by images, auxiliary files such as CSS/JS and latency."

They are and they are not. You can simply turn off downloading of external stuff (CSS files, JS files, images, objects (like embedded video)). But you can not turn off loading of the such part of XHTML source which you don't take care about or is unusable and worthless for you.

#Comment by Danny B. (talk | contribs)   04:27, 23 January 2009

Because language names are random lexical category (nouns, adjectives and adverbs), the message can't be done this way.

Suggesting the following form:

title="<language_name>: <target_page_name>"

#Comment by Werdna (talk | contribs)   04:50, 23 January 2009

Languages should always be nouns, shouldn't they? Surely "Version in $language" would make some sense.

#Comment by Danny B. (talk | contribs)   14:23, 23 January 2009

Maybe they should, but they definitely are not. Some are adverbs. Some are adjectives, because the "full" name is in form "such language", but there's only the adjective "such" in language names used. That applies in slavonic languages a lot.

Such languages also have grammar cases, so the form used for interwiki doesn't necessarily be suitable for "version in $language" form.

There will also be major issues with with appropriate grammatical gender. While "language" is mostly masculine, "version" is mostly feminine. Thus you can't connect the language name with the word "version".

An example from my mother tongue (cs):

  • Český jazyk (Czech language - adj. m. nom., subst. m. nom.) - the "full" name
  • Čeština (Czech - subst. f. nom.) - the "short" name
  • Český (Czech - adj. m. nom.) - mind the similarity to the first example - this is the usual case in slavonic interwikis
  • Česky[1] ((in) Czech - adv.)
  • Česká (Czech - adj. f. nom.)
  • Česká verze[2] (Czech version - adj. f. nom., subst. f. nom.)
  • Verze česky[3] (Version in Czech - subst. f. nom., adv.) - stylistically unusable in this case
  • Verze v českém jazyce[3] (Version in Czech language - subst. f. nom., prep., adj. m. loc., subst. m. loc.) - the "full" name used
  • Verze v češtině[3] (Version in Czech - subst. f. nom., prep., subst. f. loc.) - the "short" name used
  1. Currently used in interwiki
  2. Usable form for message in form of this revision
  3. Usable form in form you proposed above

Slavonic languages are on the same base, so they more or less fit this scheme.

The proposed form is grammar case and gender insensitive, all three lexical categories used sound sane as well as random genders.

#Comment by Purodha (talk | contribs)   11:13, 24 January 2009

I confirm that, several Germanic languages are having very similar grammatical problems to those, Danny B. mentions, and lack a simple way to say "<language> version" for all classes of language names by their onomasiologies and genders. See also http://translatewiki.net/wiki/Support#Highly_problematic_new_message

#Comment by Purodha (talk | contribs)   11:23, 24 January 2009

Not so in some cases in some Germanic languages, where you have ony "Language of <place>" or "<adjective pertainig to a place, population, or enthnic group> <one word of several for 'language', 'way of speech', etc.>" and even then "Version in <language>" would require to insert an article in front of <language> and inflections be applied to the word(s inside the expression) <language>.

#Comment by Purodha (talk | contribs)   11:25, 24 January 2009

Sorry, I forgot to mention, this comment goes to [[User:Werdna|]]

#Comment by Purodha (talk | contribs)   13:05, 25 January 2009

Another comment to Werdna: Some languages do not even have a concept of nouns, which is a bit hard for us "Indo-Europeans" to grasp, I know.

#Comment by Danny B. (talk | contribs)   04:44, 23 January 2009

Added xml:lang in r46062.

#Comment by Nikerabbit (talk | contribs)   06:52, 23 January 2009

What about interlanguage links, which aren't (correct) language codes? Why is it using message in ui language but fetching the language name from content language?

#Comment by Brion VIBBER (talk | contribs)   23:08, 27 January 2009

Pulling this back for the moment in r46397.

Status & tagging log