r101295 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101294‎ | r101295 | r101296 >
Date:03:45, 30 October 2011
Author:smoke3723
Status:deferred
Tags:
Comment:
Internationalisation codes corrected to current standards
Modified paths:
  • /trunk/extensions/Sternograph/Sternograph.body.php (modified) (history)
  • /trunk/extensions/Sternograph/Sternograph.i18n.php (modified) (history)
  • /trunk/extensions/Sternograph/Sternograph.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Sternograph/Sternograph.i18n.php
@@ -8,36 +8,36 @@
99 * Translation documentation.
1010 */
1111 $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.',
1616
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.'
2525 );
2626
2727 /**
2828 * English
2929 */
3030 $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.',
3535
36 - 'speakerPre'=>'',
37 - 'speakerPost'=>':&nbsp;',
38 - 'blockPre'=>'',
39 - 'blockPost'=>'',
40 - 'inlinePre'=>'[',
41 - 'inlinePost'=>']',
42 - 'contextPre'=>'&mdash;',
43 - 'contextPost'=>''
 36+ 'sternograph-speaker-pre'=>'',
 37+ 'sternograph-speaker-post'=>':&nbsp;',
 38+ 'sternograph-block-pre'=>'',
 39+ 'sternograph-block-post'=>'',
 40+ 'sternograph-inline-pre'=>'[',
 41+ 'sternograph-inline-post'=>']',
 42+ 'sternograph-context-pre'=>'&mdash;',
 43+ 'sternograph-context-post'=>''
4444 );
Index: trunk/extensions/Sternograph/Sternograph.php
@@ -6,10 +6,10 @@
77 $wgExtensionCredits['parserhook'][] = array(
88 'path' => __FILE__,
99 'name' => 'Sternograph',
10 - 'version' => '0.0',
 10+ 'version' => '1.1',
1111 'author' =>'Smoke 003723',
1212 'url' => 'http://www.mediawiki.org/wiki/Extension:Sternograph',
13 - 'descriptionmsg' => 'descriptionmsg'
 13+ 'descriptionmsg' => 'sternograph-descriptionmsg'
1414 );
1515
1616 function efSternograph(&$parser){
Index: trunk/extensions/Sternograph/Sternograph.body.php
@@ -53,10 +53,10 @@
5454 public function parse($input, array $args, Parser $parser, PPFrame $frame){
5555 //Sanity checks
5656 if ($input == null){
57 - return Sternograph::error('empty');
 57+ return Sternograph::error('sternograph-empty', Sternograph::TAG);
5858 }
5959 if (preg_match('/<\s*'.Sternograph::TAG.'\s*>/', $input) > 0){
60 - return Sternograph::error('nested');
 60+ return Sternograph::error('sternograph-nested', Sternograph::TAG);
6161 }
6262 //3 chunks we have to work through:
6363 $speakers = null;
@@ -79,9 +79,9 @@
8080 }else{
8181 $input = substr($lines, 0, $context);
8282 $context = substr($lines, $context + strlen(Sternograph::CONTEXT_DELIM));
83 - $context = wfMsgNoTrans('contextPre').
 83+ $context = wfMsgNoTrans('sternograph-context-pre').
8484 trim($context).
85 - wfMsgNoTrans('contextPost');
 85+ wfMsgNoTrans('sternograph-context-post');
8686 $context = '<div class="sternographContext">'.
8787 $parser->recursiveTagParse($context, $frame).
8888 '</div>';
@@ -143,12 +143,12 @@
144144 $raw[1] = trim($raw[1]);
145145 return $raw;
146146 }else{
147 - return Sternograph::error('speakerIs');
 147+ return Sternograph::error('sternograph-speaker-is', Sternograph::TAG, Sternograph::SPEAKER_IS);
148148 }
149149 }
150150
151151 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');
153153 $raw = Sternograph::splitSpeaker($raw);
154154 if (!is_array($raw)){
155155 return $raw;
@@ -159,7 +159,7 @@
160160 }else{
161161 $raw[0] = $speakers[$raw[0]];
162162 }
163 - $result .= $raw[0].wfMsgNoTrans('speakerPost').'</font>';
 163+ $result .= $raw[0].wfMsgNoTrans('sternograph-speaker-post').'</font>';
164164 $raw = explode(Sternograph::INLINE, $raw[1]);
165165 $limit = count($raw);
166166 $result .= Sternograph::expandSpeakers($raw[0], $speakers, $parser, $frame);
@@ -188,13 +188,13 @@
189189 static private function direction($raw, $speakers, $block, Parser $parser, PPFrame $frame){
190190 if ($block === true){
191191 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'),
194194 $speakers, $parser, $frame).'</font>';
195195 }else{
196196 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'),
199199 $speakers, $parser, $frame).'</font>';
200200 }
201201 }
@@ -203,8 +203,8 @@
204204 /**
205205 Returns the i18n'd error message.
206206 */
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>';
209209 }
210210
211211 /**

Follow-up revisions

RevisionCommit summaryAuthorDate
r102293r101295: Consistency tweaks in preparation for adding extension to translatew...raymond15:52, 7 November 2011
r102294r101295: Adding extension to translatewiki.netraymond15:52, 7 November 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r99842Adding Sternograph extensionsmoke372303:10, 15 October 2011

Status & tagging log