Index: trunk/extensions/SiteMatrix/SiteMatrix_body.php |
— | — | @@ -185,6 +185,13 @@ |
186 | 186 | $this->outputHeader(); |
187 | 187 | |
188 | 188 | $matrix = new SiteMatrix(); |
| 189 | + |
| 190 | + if( class_exists( 'LanguageNames' ) ) { |
| 191 | + global $wgLang; |
| 192 | + $localLanguageNames = LanguageNames::getNames( $wgLang->getCode() ); |
| 193 | + } else { |
| 194 | + $localLanguageNames = array(); |
| 195 | + } |
189 | 196 | |
190 | 197 | if( $wgRequest->getVal( 'action' ) == 'raw' ){ |
191 | 198 | $wgOut->disable(); |
— | — | @@ -195,7 +202,14 @@ |
196 | 203 | echo "\t<matrix size=\"{$count}\">\n"; |
197 | 204 | foreach ( $matrix->getLangList() as $lang ) { |
198 | 205 | $langhost = str_replace( '_', '-', $lang ); |
199 | | - echo "\t\t<language code=\"{$langhost}\" name=\"".htmlspecialchars( $wgLanguageNames[$lang] )."\">\n"; |
| 206 | + $attribs = array( |
| 207 | + 'code' => $langhost, |
| 208 | + 'name' => $wgLanguageNames[$lang], |
| 209 | + ); |
| 210 | + if( isset( $localLanguageNames[$lang] ) ) { |
| 211 | + $attribs['localname'] = $localLanguageNames[$lang]; |
| 212 | + } |
| 213 | + echo "\t\t" . Xml::openElement( 'language', $attribs ) . "\n"; |
200 | 214 | foreach ( $matrix->getSites() as $site ) { |
201 | 215 | if ( $matrix->exist( $lang, $site ) ) { |
202 | 216 | $url = $matrix->getUrl( $lang, $site ); |
— | — | @@ -239,7 +253,11 @@ |
240 | 254 | foreach ( $matrix->getLangList() as $lang ) { |
241 | 255 | $anchor = strtolower( '<a id="' . htmlspecialchars( $lang ) . '" name="' . htmlspecialchars( $lang ) . '"></a>' ); |
242 | 256 | $s .= '<tr>'; |
243 | | - $s .= '<td>' . $anchor . '<strong>' . $wgLanguageNames[$lang] . '</strong></td>'; |
| 257 | + $attribs = array(); |
| 258 | + if( isset( $localLanguageNames[$lang] ) ) { |
| 259 | + $attribs['title'] = $localLanguageNames[$lang]; |
| 260 | + } |
| 261 | + $s .= '<td>' . $anchor . Xml::element( 'strong', $attribs ) . $wgLanguageNames[$lang] . '</strong></td>'; |
244 | 262 | $langhost = str_replace( '_', '-', $lang ); |
245 | 263 | foreach ( $matrix->getNames() as $site => $name ) { |
246 | 264 | $url = $matrix->getUrl( $lang, $site ); |
— | — | @@ -308,6 +326,14 @@ |
309 | 327 | $matrix_out = array( |
310 | 328 | 'count' => $matrix->getCount(), |
311 | 329 | ); |
| 330 | + |
| 331 | + if( class_exists( 'LanguageNames' ) ) { |
| 332 | + global $wgLang; |
| 333 | + $localLanguageNames = LanguageNames::getNames( $wgLang->getCode() ); |
| 334 | + } else { |
| 335 | + $localLanguageNames = array(); |
| 336 | + } |
| 337 | + |
312 | 338 | foreach ( $matrix->getLangList() as $lang ) { |
313 | 339 | $langhost = str_replace( '_', '-', $lang ); |
314 | 340 | $language = array( |
— | — | @@ -315,6 +341,9 @@ |
316 | 342 | 'name' => $wgLanguageNames[$lang], |
317 | 343 | 'site' => array(), |
318 | 344 | ); |
| 345 | + if( isset( $localLanguageNames[$lang] ) ) { |
| 346 | + $language['localname'] = $localLanguageNames[$lang]; |
| 347 | + } |
319 | 348 | |
320 | 349 | foreach ( $matrix->getSites() as $site ) { |
321 | 350 | if ( $matrix->exist( $lang, $site ) ) { |