Index: trunk/extensions/Babel/Babel.class.php |
— | — | @@ -26,21 +26,20 @@ |
27 | 27 | self::mTemplateLinkBatch( $parameters ); |
28 | 28 | |
29 | 29 | $content = ''; |
30 | | - $templateParameters = array(); // collects name=value parameters to be passed to wiki templates. |
| 30 | + $templateParameter[0] = '' ; // collects name=value parameters to be passed to wiki templates. |
31 | 31 | foreach ( $parameters as $name ) { |
32 | 32 | if (strpos($name, '=') !== false) { |
33 | 33 | $templateParameters[] = $name; |
34 | 34 | continue; |
35 | 35 | } |
36 | 36 | $components = self::mParseParameter( $name ); |
37 | | - $template = wfMsgForContent( 'babel-template', $name ); |
| 37 | + $template = wfMessage( 'babel-template', $name )->inContentLanguage()->text(); |
38 | 38 | if ( $name === '' ) { |
39 | 39 | continue; |
40 | 40 | } elseif ( self::mPageExists( $template ) ) { |
41 | 41 | // Existent template page has precedence |
42 | | - if ( count($templateParameters) ) { |
43 | | - $template .= '|'.implode('|', $templateParameters); |
44 | | - } |
| 42 | + $templateParameters[0] = $template; |
| 43 | + $template = implode('|', $templateParameters); |
45 | 44 | $content .= self::mGenerateNotaBox( $parser->replaceVariables( "{{{$template}}}" ) ); |
46 | 45 | } elseif ( $components !== false ) { |
47 | 46 | // Non-existent page and valid parameter syntax, babel box |
— | — | @@ -100,7 +99,7 @@ |
101 | 100 | protected static function mTemplateLinkBatch( $parameters ) { |
102 | 101 | $titles = array(); |
103 | 102 | foreach ( $parameters as $name ) { |
104 | | - $title = Title::newFromText( wfMsgForContent( 'babel-template', $name ) ); |
| 103 | + $title = Title::newFromText( wfMessage( 'babel-template', $name )->inContentLanguage()->text() ); |
105 | 104 | if ( is_object( $title ) ) { |
106 | 105 | $titles[] = $title; |
107 | 106 | } |
— | — | @@ -175,15 +174,15 @@ |
176 | 175 | } |
177 | 176 | |
178 | 177 | /** |
179 | | - * Generate an inner box which is not a babel box. |
| 178 | + * Generate an inner item which is not a babel box. |
180 | 179 | * |
181 | | - * @param $coontent String: what's inside the box, in wikitext format. |
| 180 | + * @param $content String: what's inside the box, in wikitext format. |
182 | 181 | * @return String: A single non-babel box, in wikitext format. |
183 | 182 | */ |
184 | 183 | protected static function mGenerateNotaBox( $content ) { |
185 | | - $dir_content = wfMessage( 'babel-directionality' )->inContentLanguage()->text(); |
| 184 | + $dir_head = Babel::mHtmlAttrib( 'dir', 'babel-directionality' ); |
186 | 185 | $notabox = <<<EOT |
187 | | -<div class="mw-babel-notabox" dir="$dir_content">$content</div> |
| 186 | +<div class="mw-babel-notabox"$dir_head>$content</div> |
188 | 187 | EOT; |
189 | 188 | return $notabox; |
190 | 189 | } |
— | — | @@ -196,8 +195,8 @@ |
197 | 196 | * @return String: A single babel box, in wikitext format. |
198 | 197 | */ |
199 | 198 | protected static function mGenerateBox( $code, $level ) { |
200 | | - $portal = wfMsgForContent( 'babel-portal', $code ); |
201 | 199 | $lang = wfBCP47( $code ); |
| 200 | + $portal = wfMsgForContent( 'babel-portal', $code ); |
202 | 201 | $header = "[[$portal|" . $lang . "]]<span class=\"mw-babel-box-level-$level\">-$level</span>"; |
203 | 202 | |
204 | 203 | $code = strtolower( $code ); |
— | — | @@ -205,17 +204,17 @@ |
206 | 205 | $code = BabelLanguageCodes::getCode( $code ); |
207 | 206 | $text = self::mGetText( $name, $code, $level ); |
208 | 207 | |
209 | | - $dir_content = wfMsgForContent( 'babel-directionality' ); |
210 | 208 | $dir_current = wfMsgExt( 'babel-directionality', array( 'language' => $code ) ); |
211 | 209 | |
212 | 210 | $cellspacing = Babel::mHtmlAttrib( 'cellspacing', 'babel-cellspacing' ); |
213 | 211 | $cellpadding = Babel::mHtmlAttrib( 'cellpadding', 'babel-cellpadding' ); |
| 212 | + $dir_head = Babel::mHtmlAttrib( 'dir', 'babel-directionality' ); |
214 | 213 | |
215 | 214 | $box = <<<EOT |
216 | | -<div class="mw-babel-box mw-babel-box-$level" dir="$dir_content"> |
| 215 | +<div class="mw-babel-box mw-babel-box-$level"$dir_head> |
217 | 216 | {|$cellspacing$cellpadding |
218 | | -! dir="$dir_content" | $header |
219 | | -| dir="$dir_current" lang="$lang" xml:lang="$lang" | $text |
| 217 | +!$dir_head | $header |
| 218 | +| dir="$dir_current" lang="$lang" xml:lang="$lang" | $text |
220 | 219 | |} |
221 | 220 | </div> |
222 | 221 | EOT; |
— | — | @@ -314,7 +313,7 @@ |
315 | 314 | } |
316 | 315 | |
317 | 316 | /** |
318 | | - * Determine a HTML attribute, such as "cellspacing" or "cellpadding". |
| 317 | + * Determine an HTML attribute, such as "cellspacing" or "title", from a localizeable message. |
319 | 318 | * |
320 | 319 | * @param $name String: name of HTML attribute. |
321 | 320 | * @param $key String: Message key of attribute value. |