Index: trunk/extensions/Sternograph/Sternograph.i18n.php |
— | — | @@ -8,36 +8,36 @@ |
9 | 9 | * Translation documentation. |
10 | 10 | */ |
11 | 11 | $messages['qqq'] = array( |
12 | | - 'descriptionmsg'=>'Description of the Sternograph extension; displayed on the Special:Extensions page only.', |
13 | | - 'empty' => 'Error message when an empty <sterno> tag is detected on the wiki-formatted page.', |
14 | | - 'nested'=>'Error message when a <sterno> tag occurs within an existing <sterno> tag on the wiki-formatted page.', |
15 | | - 'speakerIs' => 'Error message when a speaker block does not contain the speaker delimeter on the wiki-formatted page. The character to include is defined by the Sternograph::SPEAKER_IS variable, and should be included in the error message.', |
| 12 | + 'sternograph-descriptionmsg'=>'Description of the Sternograph extension; displayed on the Special:Extensions page only.', |
| 13 | + 'sternograph-empty' => 'Error message when an empty tag is detected on the wiki-formatted page. The tag name to display is parsed to this function as the first parameter.', |
| 14 | + 'sternograph-nested'=>'Error message when a sternograph tag occurs within an existing sternograph tag on the wiki-formatted page. The tag name to display is the first parameter.', |
| 15 | + 'sternograph-speaker-is' => 'Error message when a speaker block does not contain the speaker delimeter on the wiki-formatted page. The tag name to display is the first parameter; the character that is required is the second parameter.', |
16 | 16 | |
17 | | - 'speakerPre'=>'Text that will always occur before the name of a speaker in the formatted text. This text is formatted by the sternographName CSS class.', |
18 | | - 'speakerPost'=>'Text that will always occur after the name of a speaker in the formatted text. This text is formatted by the sternographName CSS class.', |
19 | | - 'blockPre'=>'Text that will always occur before a stage direction block in the formatted text. This text is formatted by the sternographDirection and sternographDirectionBlock CSS classes.', |
20 | | - 'blockPost'=>'Text that will always occur after a stage direction block in the formatted text. This text is formatted by the sternographDirection and sternographDirectionBlock CSS classes.', |
21 | | - 'inlinePre'=>'Text that will always occur before an in-line stage direction in the formatted text. This text is formatted by the sternographDirection and sternographDirectionInline CSS classes.', |
22 | | - 'inlinePost'=>'Text that will always occur after an in-line stage direction in the formatted text. This text is formatted by the sternographDirection and sternographDirectionInline CSS classes.', |
23 | | - 'contextPre'=>'Text that will always occur before the context block in the formatted text. This text is formatted by the sternographContext CSS class.', |
24 | | - 'contextPost'=>'Text that will always occur after the context block in the formatted text. This text is formatted by the sternographContext CSS class.' |
| 17 | + 'sternograph-speaker-pre'=>'Text that will always occur before the name of a speaker in the formatted text. This text is formatted by the sternographName CSS class.', |
| 18 | + 'sternograph-speaker-post'=>'Text that will always occur after the name of a speaker in the formatted text. This text is formatted by the sternographName CSS class.', |
| 19 | + 'sternograph-block-pre'=>'Text that will always occur before a stage direction block in the formatted text. This text is formatted by the sternographDirection and sternographDirectionBlock CSS classes.', |
| 20 | + 'sternograph-block-post'=>'Text that will always occur after a stage direction block in the formatted text. This text is formatted by the sternographDirection and sternographDirectionBlock CSS classes.', |
| 21 | + 'sternograph-inline-pre'=>'Text that will always occur before an in-line stage direction in the formatted text. This text is formatted by the sternographDirection and sternographDirectionInline CSS classes.', |
| 22 | + 'sternograph-inline-post'=>'Text that will always occur after an in-line stage direction in the formatted text. This text is formatted by the sternographDirection and sternographDirectionInline CSS classes.', |
| 23 | + 'sternograph-context-pre'=>'Text that will always occur before the context block in the formatted text. This text is formatted by the sternographContext CSS class.', |
| 24 | + 'sternograph-context-post'=>'Text that will always occur after the context block in the formatted text. This text is formatted by the sternographContext CSS class.' |
25 | 25 | ); |
26 | 26 | |
27 | 27 | /** |
28 | 28 | * English |
29 | 29 | */ |
30 | 30 | $messages['en'] = array( |
31 | | - 'descriptionmsg'=>'<sterno> tags for transcripts of spokens words (plays, interviews, etc).', |
32 | | - 'empty' => '<sterno> tag cannot be empty.', |
33 | | - 'nested'=>'<sterno> tag cannot be nested.', |
34 | | - 'speakerIs' => '<sterno> speaker block lines must have $1 character.', |
| 31 | + 'sternograph-descriptionmsg'=>'<sterno> tags for transcripts of spokens words (plays, interviews, etc).', |
| 32 | + 'sternograph-empty' => '<$1> tag cannot be empty.', |
| 33 | + 'sternograph-nested'=>'<$1> tag cannot be nested.', |
| 34 | + 'sternograph-speaker-is' => '<$1> speaker block lines must have $2 character.', |
35 | 35 | |
36 | | - 'speakerPre'=>'', |
37 | | - 'speakerPost'=>': ', |
38 | | - 'blockPre'=>'', |
39 | | - 'blockPost'=>'', |
40 | | - 'inlinePre'=>'[', |
41 | | - 'inlinePost'=>']', |
42 | | - 'contextPre'=>'—', |
43 | | - 'contextPost'=>'' |
| 36 | + 'sternograph-speaker-pre'=>'', |
| 37 | + 'sternograph-speaker-post'=>': ', |
| 38 | + 'sternograph-block-pre'=>'', |
| 39 | + 'sternograph-block-post'=>'', |
| 40 | + 'sternograph-inline-pre'=>'[', |
| 41 | + 'sternograph-inline-post'=>']', |
| 42 | + 'sternograph-context-pre'=>'—', |
| 43 | + 'sternograph-context-post'=>'' |
44 | 44 | ); |
Index: trunk/extensions/Sternograph/Sternograph.php |
— | — | @@ -6,10 +6,10 @@ |
7 | 7 | $wgExtensionCredits['parserhook'][] = array( |
8 | 8 | 'path' => __FILE__, |
9 | 9 | 'name' => 'Sternograph', |
10 | | - 'version' => '0.0', |
| 10 | + 'version' => '1.1', |
11 | 11 | 'author' =>'Smoke 003723', |
12 | 12 | 'url' => 'http://www.mediawiki.org/wiki/Extension:Sternograph', |
13 | | - 'descriptionmsg' => 'descriptionmsg' |
| 13 | + 'descriptionmsg' => 'sternograph-descriptionmsg' |
14 | 14 | ); |
15 | 15 | |
16 | 16 | function efSternograph(&$parser){ |
Index: trunk/extensions/Sternograph/Sternograph.body.php |
— | — | @@ -53,10 +53,10 @@ |
54 | 54 | public function parse($input, array $args, Parser $parser, PPFrame $frame){ |
55 | 55 | //Sanity checks |
56 | 56 | if ($input == null){ |
57 | | - return Sternograph::error('empty'); |
| 57 | + return Sternograph::error('sternograph-empty', Sternograph::TAG); |
58 | 58 | } |
59 | 59 | if (preg_match('/<\s*'.Sternograph::TAG.'\s*>/', $input) > 0){ |
60 | | - return Sternograph::error('nested'); |
| 60 | + return Sternograph::error('sternograph-nested', Sternograph::TAG); |
61 | 61 | } |
62 | 62 | //3 chunks we have to work through: |
63 | 63 | $speakers = null; |
— | — | @@ -79,9 +79,9 @@ |
80 | 80 | }else{ |
81 | 81 | $input = substr($lines, 0, $context); |
82 | 82 | $context = substr($lines, $context + strlen(Sternograph::CONTEXT_DELIM)); |
83 | | - $context = wfMsgNoTrans('contextPre'). |
| 83 | + $context = wfMsgNoTrans('sternograph-context-pre'). |
84 | 84 | trim($context). |
85 | | - wfMsgNoTrans('contextPost'); |
| 85 | + wfMsgNoTrans('sternograph-context-post'); |
86 | 86 | $context = '<div class="sternographContext">'. |
87 | 87 | $parser->recursiveTagParse($context, $frame). |
88 | 88 | '</div>'; |
— | — | @@ -143,12 +143,12 @@ |
144 | 144 | $raw[1] = trim($raw[1]); |
145 | 145 | return $raw; |
146 | 146 | }else{ |
147 | | - return Sternograph::error('speakerIs'); |
| 147 | + return Sternograph::error('sternograph-speaker-is', Sternograph::TAG, Sternograph::SPEAKER_IS); |
148 | 148 | } |
149 | 149 | } |
150 | 150 | |
151 | 151 | static private function line($raw, $speakers, Parser $parser, PPFrame $frame){ |
152 | | - $result = '<font class="sternographName">'.wfMsgNoTrans('speakerPre'); |
| 152 | + $result = '<font class="sternographName">'.wfMsgNoTrans('sternograph-speaker-pre'); |
153 | 153 | $raw = Sternograph::splitSpeaker($raw); |
154 | 154 | if (!is_array($raw)){ |
155 | 155 | return $raw; |
— | — | @@ -159,7 +159,7 @@ |
160 | 160 | }else{ |
161 | 161 | $raw[0] = $speakers[$raw[0]]; |
162 | 162 | } |
163 | | - $result .= $raw[0].wfMsgNoTrans('speakerPost').'</font>'; |
| 163 | + $result .= $raw[0].wfMsgNoTrans('sternograph-speaker-post').'</font>'; |
164 | 164 | $raw = explode(Sternograph::INLINE, $raw[1]); |
165 | 165 | $limit = count($raw); |
166 | 166 | $result .= Sternograph::expandSpeakers($raw[0], $speakers, $parser, $frame); |
— | — | @@ -188,13 +188,13 @@ |
189 | 189 | static private function direction($raw, $speakers, $block, Parser $parser, PPFrame $frame){ |
190 | 190 | if ($block === true){ |
191 | 191 | return '<font class="sternographDirection sternographDirectionBlock">'. |
192 | | - Sternograph::expandSpeakers(wfMsgNoTrans('blockPre'). |
193 | | - $raw.wfMsgNoTrans('blockPost'), |
| 192 | + Sternograph::expandSpeakers(wfMsgNoTrans('sternograph-block-pre'). |
| 193 | + $raw.wfMsgNoTrans('sternograph-block-post'), |
194 | 194 | $speakers, $parser, $frame).'</font>'; |
195 | 195 | }else{ |
196 | 196 | return '<font class="sternographDirection sternographDirectionInline">'. |
197 | | - Sternograph::expandSpeakers(wfMsgNoTrans('inlinePre'). |
198 | | - $raw.wfMsgNoTrans('inlinePost'), |
| 197 | + Sternograph::expandSpeakers(wfMsgNoTrans('sternograph-inline-pre'). |
| 198 | + $raw.wfMsgNoTrans('sternograph-inline-post'), |
199 | 199 | $speakers, $parser, $frame).'</font>'; |
200 | 200 | } |
201 | 201 | } |
— | — | @@ -203,8 +203,8 @@ |
204 | 204 | /** |
205 | 205 | Returns the i18n'd error message. |
206 | 206 | */ |
207 | | - static private function error($key, $param = ''){ |
208 | | - return '<strong class="error">' . htmlspecialchars( wfMsgForContent( $key, $param ) ) .'</strong>'; |
| 207 | + static private function error($key, $param1 = '', $param2 = ''){ |
| 208 | + return '<strong class="error">' . htmlspecialchars( wfMsgForContent( $key, $param1, $param2 ) ) .'</strong>'; |
209 | 209 | } |
210 | 210 | |
211 | 211 | /** |