r48179 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r48178‎ | r48179 | r48180 >
Date:19:41, 8 March 2009
Author:nikerabbit
Status:ok
Tags:
Comment:
* Commalist
Modified paths:
  • /trunk/extensions/Translate/MessageChecks.php (modified) (history)
  • /trunk/extensions/Translate/Translate.i18n.php (modified) (history)
  • /trunk/extensions/Translate/Translate.php (modified) (history)
  • /trunk/extensions/Translate/TranslateEditAddons.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/TranslateEditAddons.php
@@ -89,9 +89,29 @@
9090
9191 static function addTools( $object ) {
9292 $object->editFormTextTop .= self::editBoxes( $object );
 93+ global $wgMessageCache, $wgLang;
 94+ $wgMessageCache->addMessage( 'savearticle', "Save as {$wgLang->getCode()}", $wgLang->getCode() );
9395 return true;
9496 }
9597
 98+ static function buttonHack( $editpage, &$buttons, $tabindex ) {
 99+ global $wgLang;
 100+ list( , $code ) = self::figureMessage( $editpage->mTitle );
 101+ if ( $code !== 'qqq' ) return true;
 102+ $name = TranslateUtils::getLanguageName( $code, false, $wgLang->getCode() );
 103+ $temp = array(
 104+ 'id' => 'wpSave',
 105+ 'name' => 'wpSave',
 106+ 'type' => 'submit',
 107+ 'tabindex' => ++$tabindex,
 108+ 'value' => wfMsg( 'translate-save', $name ),
 109+ 'accesskey' => wfMsg( 'accesskey-save' ),
 110+ 'title' => wfMsg( 'tooltip-save' ).' ['.wfMsg( 'accesskey-save' ).']',
 111+ );
 112+ $buttons['save'] = Xml::element('input', $temp, '');
 113+ return true;
 114+ }
 115+
96116 private static function getFallbacks( $code ) {
97117 global $wgTranslateLanguageFallbacks, $wgTranslateDocumentationLanguageCode;
98118
Index: trunk/extensions/Translate/Translate.php
@@ -46,6 +46,7 @@
4747 $wgHooks['EditPage::showEditForm:initial'][] = 'TranslateEditAddons::addTools';
4848 $wgHooks['OutputPageBeforeHTML'][] = 'TranslateEditAddons::addNavigation';
4949 $wgHooks['AlternateEdit'][] = 'TranslateEditAddons::intro';
 50+$wgHooks['EditPageBeforeEditButtons'][] = 'TranslateEditAddons::buttonHack';
5051
5152 $wgHooks['UserToggles'][] = 'TranslatePreferences::TranslateUserToggles';
5253 $wgHooks['SpecialRecentChangesQuery'][] = 'TranslateRcFilter::translationFilter';
Index: trunk/extensions/Translate/MessageChecks.php
@@ -112,7 +112,7 @@
113113 if ( $count = count( $missing ) ) {
114114 global $wgLang;
115115 $desc = array( 'translate-checks-parameters',
116 - implode( ', ', $missing ),
 116+ $wgLang->commalist( $missing ),
117117 $wgLang->formatNum( $count ) );
118118 return true;
119119 }
@@ -138,7 +138,7 @@
139139 if ( $count = count( $missing ) ) {
140140 global $wgLang;
141141 $desc = array( 'translate-checks-parameters-unknown',
142 - implode( ', ', $missing ),
 142+ $wgLang->commalist( $missing ),
143143 $wgLang->formatNum( $count ) );
144144 return true;
145145 }
@@ -174,7 +174,7 @@
175175 if ( $count = count( $balance ) ) {
176176 global $wgLang;
177177 $desc = array( 'translate-checks-balance',
178 - implode( ', ', $balance ),
 178+ $wgLang->commalist( $balance ),
179179 $wgLang->formatNum( $count ) );
180180 return true;
181181 }
@@ -213,7 +213,7 @@
214214 if ( $count = count( $links ) ) {
215215 global $wgLang;
216216 $desc = array( 'translate-checks-links',
217 - implode( ', ', $links ),
 217+ $wgLang->commalist( $links ),
218218 $wgLang->formatNum( $count ) );
219219 return true;
220220 }
@@ -253,7 +253,7 @@
254254 if ( $count = count( $wrongTags ) ) {
255255 global $wgLang;
256256 $desc = array( 'translate-checks-xhtml',
257 - implode( ', ', $wrongTags ),
 257+ $wgLang->commalist( $wrongTags ),
258258 $wgLang->formatNum( $count ) );
259259 return true;
260260 }
@@ -358,7 +358,7 @@
359359 if ( $count = count( $missing ) ) {
360360 global $wgLang;
361361 $desc = array( 'translate-checks-parameters',
362 - implode( ', ', $missing ),
 362+ $wgLang->commaList( $missing ),
363363 $wgLang->formatNum( $count ) );
364364 return true;
365365 } else {
@@ -384,7 +384,7 @@
385385 if ( $count = count( $missing ) ) {
386386 global $wgLang;
387387 $desc = array( 'translate-checks-parameters-unknown',
388 - implode( ', ', $missing ),
 388+ $wgLang->commaList( $missing ),
389389 $wgLang->formatNum( $count ) );
390390 return true;
391391 } else {
@@ -397,8 +397,9 @@
398398 preg_match_all( "/$varPattern/U", $message->translation, $transVars );
399399
400400 if ( $count = count( $transVars[0] ) ) {
 401+ global $wgLang;
401402 $desc = array( 'translate-checks-escape',
402 - '<tt><nowiki>' . implode( ', ', $transVars[0] ) . '</nowiki></tt>' );
 403+ '<tt><nowiki>' . $wgLang->commaList( $transVars[0] ) . '</nowiki></tt>' );
403404 return true;
404405 } else {
405406 return false;
@@ -423,7 +424,7 @@
424425 if ( $count = count( $missing ) ) {
425426 global $wgLang;
426427 $desc = array( 'translate-checks-parameters',
427 - implode( ', ', $missing ),
 428+ $wgLang->commaList( $missing ),
428429 $wgLang->formatNum( $count ) );
429430 return true;
430431 } else {
@@ -447,7 +448,7 @@
448449 if ( $count = count( $missing ) ) {
449450 global $wgLang;
450451 $desc = array( 'translate-checks-parameters-unknown',
451 - implode( ', ', $missing ),
 452+ $wgLang->commaList( $missing ),
452453 $wgLang->formatNum( $count ) );
453454 return true;
454455 } else {
@@ -473,7 +474,7 @@
474475 if ( $count = count( $missing ) ) {
475476 global $wgLang;
476477 $desc = array( 'translate-checks-parameters',
477 - implode( ', ', $missing ),
 478+ $wgLang->commaList( $missing ),
478479 $wgLang->formatNum( $count ) );
479480 return true;
480481 } else {
@@ -497,7 +498,7 @@
498499 if ( $count = count( $missing ) ) {
499500 global $wgLang;
500501 $desc = array( 'translate-checks-parameters-unknown',
501 - implode( ', ', $missing ),
 502+ $wgLang->commaList( $missing ),
502503 $wgLang->formatNum( $count ) );
503504 return true;
504505 } else {
Index: trunk/extensions/Translate/Translate.i18n.php
@@ -195,6 +195,8 @@
196196 'translate-languagestats-groups' => ' # Add message group IDs, one per line to restrict the message groups that
197197 # are shown on Special:LanguageStats. Non-existing message group IDs will
198198 # be ignored.', # do not duplicate this message to other languages
 199+
 200+ 'translate-save' => 'Save ($1)',
199201 );
200202
201203 /** Message documentation (Message documentation)

Status & tagging log