Index: trunk/extensions/Babel/Babel.class.php |
— | — | @@ -19,6 +19,7 @@ |
20 | 20 | * @return string: Babel tower. |
21 | 21 | */ |
22 | 22 | public static function Render( $parser ) { |
| 23 | + global $wgBabelUseUserLanguage; |
23 | 24 | $parameters = func_get_args(); |
24 | 25 | array_shift( $parameters ); |
25 | 26 | self::$title = $parser->getTitle(); |
— | — | @@ -56,7 +57,13 @@ |
57 | 58 | } |
58 | 59 | } |
59 | 60 | |
60 | | - $top = wfMessage( 'babel', self::$title->getDBkey() )->inContentLanguage(); // TODO: allow user language |
| 61 | + $top = wfMessage( 'babel', self::$title->getDBkey() )->inContentLanguage(); |
| 62 | + if ( $wgBabelUseUserLanguage ) { |
| 63 | + $top = $top->inLanguage( $parser->getOptions()->getUserLangObj() ); |
| 64 | + } else { |
| 65 | + $top = $top->inContentLanguage(); |
| 66 | + } |
| 67 | + |
61 | 68 | if ( $top->isDisabled() ) { |
62 | 69 | $top = ''; |
63 | 70 | } else { |
— | — | @@ -67,7 +74,13 @@ |
68 | 75 | } |
69 | 76 | $top = '! class="mw-babel-header" | ' . $top; |
70 | 77 | } |
71 | | - $footer = wfMessage( 'babel-footer', self::$title->getDBkey() )->inContentLanguage(); // TODO: allow user language |
| 78 | + $footer = wfMessage( 'babel-footer', self::$title->getDBkey() ); |
| 79 | + if ( $wgBabelUseUserLanguage ) { |
| 80 | + $footer = $footer->inLanguage( $parser->getOptions()->getUserLangObj() ); |
| 81 | + } else { |
| 82 | + $footer = $footer->inContentLanguage(); |
| 83 | + } |
| 84 | + |
72 | 85 | $url = wfMessage( 'babel-footer-url' )->inContentLanguage(); |
73 | 86 | $showfooter = ''; |
74 | 87 | if ( !$footer->isDisabled() && !$url->isDisabled() ) { |
Index: trunk/extensions/Babel/Babel.php |
— | — | @@ -67,6 +67,9 @@ |
68 | 68 | $wgBabelMainCategory = '%code%'; |
69 | 69 | // Default level. |
70 | 70 | $wgBabelDefaultLevel = 'N'; |
| 71 | +// Use the viewing user's language for babel box header's and footer's |
| 72 | +// May fragment parser cache, but otherwise shouldn't cause problems |
| 73 | +$wgBabelUseUserLanguage = false; |
71 | 74 | // A boolean (true or false) indicating whether ISO 639-3 codes should be preferred over ISO 639-1 codes. |
72 | 75 | $wgBabelPreferISO639_3 = false; // Not yet used. |
73 | 76 | |