Mouseover explanations for interlanguage links in native language
authorPavel Selitskas <p.selitskas@gmail.com>
Thu, 29 Nov 2012 10:42:17 +0000 (13:42 +0300)
committerPavel Selitskas <p.selitskas@gmail.com>
Fri, 4 Oct 2013 14:44:24 +0000 (17:44 +0300)
Adds a language name in User's language from CLDR
to an interwiki 'title' attribute. Believed to be
RTL-compilant.

New message added: tooltip-iwiki, added to $preloadedMessages

Bug: 5231
Change-Id: I3dcb00cdc28a10711b6703fa509b8b8d06e325a2

includes/SkinTemplate.php
languages/messages/MessagesEn.php
languages/messages/MessagesQqq.php
maintenance/language/messages.inc

index ccfb3db..d968d79 100644 (file)
@@ -131,6 +131,7 @@ class SkinTemplate extends Skin {
        public function getLanguages() {
                global $wgHideInterlanguageLinks;
                $out = $this->getOutput();
+               $userLang = $this->getLanguage();
 
                # Language links
                $language_urls = array();
@@ -151,10 +152,14 @@ class SkinTemplate extends Skin {
                                                $ilLangName = $this->formatLanguageName( $ilLangName );
                                        }
 
+                                       // CLDR extension or similar is required to localize the language name;
+                                       // otherwise we'll end up with the autonym again.
+                                       $ilLangLocalName = Language::fetchLanguageName( $ilInterwikiCode, $userLang->getCode() );
+
                                        $language_urls[] = array(
                                                'href' => $languageLinkTitle->getFullURL(),
                                                'text' => $ilLangName,
-                                               'title' => $languageLinkTitle->getText(),
+                                               'title' => wfMessage( 'tooltip-iwiki', $languageLinkTitle->getText(), $ilLangLocalName )->escaped(),
                                                'class' => $class,
                                                'lang' => wfBCP47( $ilInterwikiCode ),
                                                'hreflang' => wfBCP47( $ilInterwikiCode ),
index 225a6b2..e4d0651 100644 (file)
@@ -551,6 +551,7 @@ $preloadedMessages = array(
        'editsectionhint',
        'help',
        'helppage',
+       'tooltip-iwiki',
        'jumpto',
        'jumptonavigation',
        'jumptosearch',
@@ -972,6 +973,7 @@ See [[Special:Version|version page]].',
 'red-link-title'               => '$1 (page does not exist)',
 'sort-descending'              => 'Sort descending',
 'sort-ascending'               => 'Sort ascending',
+'tooltip-iwiki'                => '$1 – $2', # only translate this message to other languages if you have to change it
 
 # Short words for each namespace, by default used in the namespace tab in monobook
 'nstab-main'      => 'Page',
index da14d70..304d9d3 100644 (file)
@@ -962,6 +962,9 @@ Parameters:
 * $1 - page title',
 'sort-descending' => 'JavaScript message. Used by sortable table script.',
 'sort-ascending' => 'JavaScript message. Used by sortable table script.',
+'tooltip-iwiki' => 'Format of a sidebar interwiki link tooltip. Parameters:
+* $1 - Page name in the target wiki
+* $2 - Target wiki language autonym',
 
 # Short words for each namespace, by default used in the namespace tab in monobook
 'nstab-main' => 'The name for the tab of the main namespace. Example: [[Example]]
index 43be195..0e9cfef 100644 (file)
@@ -2726,6 +2726,7 @@ $wgMessageStructure = array(
                'tooltip-undo',
                'tooltip-preferences-save',
                'tooltip-summary',
+               'tooltip-iwiki',
        ),
        'stylesheets' => array(
                'common.css',