Index: trunk/phase3/skins/MonoBook.php |
— | — | @@ -334,9 +334,15 @@ |
335 | 335 | <h5><?php $this->msg('otherlanguages') ?></h5> |
336 | 336 | <div class="pBody"> |
337 | 337 | <ul> |
338 | | -<?php foreach($this->data['language_urls'] as $langlink) { ?> |
| 338 | +<?php foreach($this->data['language_urls'] as $langlink) { |
| 339 | + // Add title tag only if differ from shown text |
| 340 | + $titleTag = $langlink['title'] == $langlink['text'] |
| 341 | + ? '' |
| 342 | + : 'title="' . htmlspecialchars( $langlink['title'] ) . '"'; |
| 343 | + ?> |
339 | 344 | <li class="<?php echo htmlspecialchars($langlink['class'])?>"><?php |
340 | | - ?><a href="<?php echo htmlspecialchars($langlink['href']) ?>"><?php echo $langlink['text'] ?></a></li> |
| 345 | + ?><a href="<?php echo htmlspecialchars($langlink['href']) ?>" |
| 346 | + <? echo $titleTag ?> > <?php echo $langlink['text'] ?></a></li> |
341 | 347 | <?php } ?> |
342 | 348 | </ul> |
343 | 349 | </div> |
Index: trunk/phase3/skins/Modern.php |
— | — | @@ -332,9 +332,15 @@ |
333 | 333 | <h5><?php $this->msg('otherlanguages') ?></h5> |
334 | 334 | <div class="pBody"> |
335 | 335 | <ul> |
336 | | -<?php foreach($this->data['language_urls'] as $langlink) { ?> |
| 336 | +<?php foreach($this->data['language_urls'] as $langlink) { |
| 337 | + // Add title tag only if differ from shown text |
| 338 | + $titleTag = $langlink['title'] == $langlink['text'] |
| 339 | + ? '' |
| 340 | + : 'title="' . htmlspecialchars( $langlink['title'] ) . '"'; |
| 341 | + ?> |
337 | 342 | <li class="<?php echo htmlspecialchars($langlink['class'])?>"><?php |
338 | | - ?><a href="<?php echo htmlspecialchars($langlink['href']) ?>"><?php echo $langlink['text'] ?></a></li> |
| 343 | + ?><a href="<?php echo htmlspecialchars($langlink['href']) ?>" |
| 344 | + <? echo $titleTag ?> > <?php echo $langlink['text'] ?></a></li> |
339 | 345 | <?php } ?> |
340 | 346 | </ul> |
341 | 347 | </div><!-- pBody --> |
Index: trunk/phase3/docs/hooks.txt |
— | — | @@ -783,6 +783,10 @@ |
784 | 784 | &$result: Set this and return false to override the internal checks |
785 | 785 | $user: User the password is being validated for |
786 | 786 | |
| 787 | +'LanguageGetLocalizedLanguageNames': Use to get localized language names |
| 788 | +&$languageNames: localized language names (array) |
| 789 | +$lang: laguage code (string) |
| 790 | + |
787 | 791 | 'LanguageGetMagic': Use this to define synonyms of magic words depending of the language |
788 | 792 | $magicExtensions: associative array of magic words synonyms |
789 | 793 | $lang: laguage code (string) |
Index: trunk/phase3/includes/SkinTemplate.php |
— | — | @@ -416,8 +416,13 @@ |
417 | 417 | if ( $nt ) { |
418 | 418 | $language_urls[] = array( |
419 | 419 | 'href' => $nt->getFullURL(), |
420 | | - 'text' => ($wgContLang->getLanguageName( $nt->getInterwiki()) != ''?$wgContLang->getLanguageName( $nt->getInterwiki()) : $l), |
421 | | - 'class' => $class |
| 420 | + 'text' => ( $wgContLang->getLanguageName( $nt->getInterwiki() ) != '' |
| 421 | + ? $wgContLang->getLanguageName( $nt->getInterwiki() ) |
| 422 | + : $l ), |
| 423 | + 'class' => $class, |
| 424 | + 'title' => ( $wgLang->getLanguageNameLocalized( $nt->getInterwiki() ) != '' |
| 425 | + ? $wgLang->getLanguageNameLocalized( $nt->getInterwiki() ) |
| 426 | + : $l ) |
422 | 427 | ); |
423 | 428 | } |
424 | 429 | } |
Index: trunk/phase3/languages/Language.php |
— | — | @@ -419,14 +419,30 @@ |
420 | 420 | return wfMsgExt( $msg, array( 'parsemag', 'language' => $this ) ); |
421 | 421 | } |
422 | 422 | |
423 | | - function getLanguageName( $code ) { |
| 423 | + /** |
| 424 | + * Get a language name |
| 425 | + * |
| 426 | + * @param $code String language code |
| 427 | + * @return $localized boolean gets the localized language name |
| 428 | + */ |
| 429 | + function getLanguageName( $code, $localized = false ) { |
424 | 430 | $names = self::getLanguageNames(); |
425 | 431 | if ( !array_key_exists( $code, $names ) ) { |
426 | 432 | return ''; |
427 | 433 | } |
428 | | - return $names[$code]; |
| 434 | + if( $localized ) { |
| 435 | + $languageNames = array(); |
| 436 | + wfRunHooks( 'LanguageGetLocalizedLanguageNames', array( &$languageNames, $this->getCode() ) ); |
| 437 | + return isset( $languageNames[$code] ) ? $languageNames[$code] : $names[$code]; |
| 438 | + } else { |
| 439 | + return $names[$code]; |
| 440 | + } |
429 | 441 | } |
430 | 442 | |
| 443 | + function getLanguageNameLocalized( $code ) { |
| 444 | + return self::getLanguageName( $code, true ); |
| 445 | + } |
| 446 | + |
431 | 447 | function getMonthName( $key ) { |
432 | 448 | return $this->getMessageFromDB( self::$mMonthMsgs[$key-1] ); |
433 | 449 | } |