Index: trunk/phase3/languages/Language.php |
— | — | @@ -289,6 +289,7 @@ |
290 | 290 | MAG_URLENCODE => array( 0, 'URLENCODE:' ), |
291 | 291 | MAG_CURRENTTIMESTAMP => array( 1, 'CURRENTTIMESTAMP' ), |
292 | 292 | MAG_DIRECTIONMARK => array( 1, 'DIRECTIONMARK', 'DIRMARK' ), |
| 293 | + MAG_LANGUAGE => array( 0, '#LANGUAGE:' ), |
293 | 294 | ); |
294 | 295 | |
295 | 296 | if (!$wgCachedMessageArrays) { |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -386,6 +386,7 @@ |
387 | 387 | * (bug 6106) Update to Indonesian localisation (id) #17 |
388 | 388 | * (bug 6125) Add links to edit old versions to diff views |
389 | 389 | * (bug 5127) Auto edit summary when creating redirect page |
| 390 | +* (bug 3926) Introduce {{#language:}} magic word |
390 | 391 | |
391 | 392 | == Compatibility == |
392 | 393 | |
Index: trunk/phase3/includes/Parser.php |
— | — | @@ -2713,6 +2713,16 @@ |
2714 | 2714 | } |
2715 | 2715 | } |
2716 | 2716 | |
| 2717 | + # #LANGUAGE: |
| 2718 | + if( !$found ) { |
| 2719 | + $mwLanguage =& MagicWord::get( MAG_LANGUAGE ); |
| 2720 | + if( $mwLanguage->matchStartAndRemove( $part1 ) ) { |
| 2721 | + $lang = $wgContLang->getLanguageName( strtolower( $part1 ) ); |
| 2722 | + $text = $linestart . ( $lang != '' ? $lang : $part1 ); |
| 2723 | + $found = true; |
| 2724 | + } |
| 2725 | + } |
| 2726 | + |
2717 | 2727 | # Extensions |
2718 | 2728 | if ( !$found && substr( $part1, 0, 1 ) == '#' ) { |
2719 | 2729 | $colonPos = strpos( $part1, ':' ); |
Index: trunk/phase3/includes/MagicWord.php |
— | — | @@ -91,6 +91,7 @@ |
92 | 92 | 'MAG_URLENCODE', |
93 | 93 | 'MAG_CURRENTTIMESTAMP', |
94 | 94 | 'MAG_DIRECTIONMARK', |
| 95 | + 'MAG_LANGUAGE', |
95 | 96 | ); |
96 | 97 | if ( ! defined( 'MEDIAWIKI_INSTALL' ) ) |
97 | 98 | wfRunHooks( 'MagicWordMagicWords', array( &$magicWords ) ); |
— | — | @@ -144,6 +145,7 @@ |
145 | 146 | MAG_URLENCODE, |
146 | 147 | MAG_CURRENTTIMESTAMP, |
147 | 148 | MAG_DIRECTIONMARK, |
| 149 | + MAG_LANGUAGE, |
148 | 150 | ); |
149 | 151 | if ( ! defined( 'MEDIAWIKI_INSTALL' ) ) |
150 | 152 | wfRunHooks( 'MagicWordwgVariableIDs', array( &$wgVariableIDs ) ); |