r44280 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r44279‎ | r44280 | r44281 >
Date:14:55, 7 December 2008
Author:nikerabbit
Status:ok
Tags:
Comment:
* bugfixes
Modified paths:
  • /trunk/extensions/Translate/MessageChecks.php (modified) (history)
  • /trunk/extensions/Translate/README (modified) (history)
  • /trunk/extensions/Translate/Translate.i18n.php (modified) (history)
  • /trunk/extensions/Translate/Translate.php (modified) (history)
  • /trunk/extensions/Translate/TranslateTasks.php (modified) (history)
  • /trunk/extensions/Translate/scripts/autoexport.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/Translate.php
@@ -11,7 +11,7 @@
1212 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
1313 */
1414
15 -define( 'TRANSLATE_VERSION', '9 (2008-11-24:2)' );
 15+define( 'TRANSLATE_VERSION', '9 (2008-12-07)' );
1616
1717 $wgExtensionCredits['specialpage'][] = array(
1818 'name' => 'Translate',
Index: trunk/extensions/Translate/scripts/autoexport.php
@@ -37,7 +37,11 @@
3838 }
3939
4040 if ( isset( $options['hours'] ) ) {
41 - $hours = $options['hours'];
 41+ $hours = intval($options['hours']);
 42+ if ( !$hours ) {
 43+ STDERR( "Invalid duration given, defaulting to 24 hours" );
 44+ $hours = 24;
 45+ }
4246 } else {
4347 showUsage();
4448 }
Index: trunk/extensions/Translate/TranslateTasks.php
@@ -294,6 +294,7 @@
295295
296296 public function output() {
297297 $writer = $this->group->getWriter();
 298+ $this->collection->filter( 'translation', null );
298299 return $writer->webExport( $this->collection );
299300 }
300301 }
Index: trunk/extensions/Translate/MessageChecks.php
@@ -20,6 +20,7 @@
2121 'checkLinks',
2222 'checkXHTML',
2323 'checkPagename',
 24+ 'miscMWChecks',
2425 ),
2526 'freecol' => array(
2627 'checkFreeColMissingVars',
@@ -303,6 +304,32 @@
304305 }
305306
306307 /**
 308+ * Checks for some micellangelous messages with special syntax.
 309+ *
 310+ * @param $message Instance of TMessage.
 311+ * @return True if namespace has been tampered with.
 312+ */
 313+ protected function miscMWChecks( TMessage $message, $code, &$desc = null ) {
 314+ $timeList = array( 'Protect-expiry-options', 'Ipboptions' );
 315+ if ( in_array( $message->key, $timeList, true ) ) {
 316+ $defArray = explode( ',', $message->definition );
 317+ $traArray = explode( ',', $message->translation );
 318+ if ( count($defArray) !== count($traArray) ) {
 319+ $desc = array( 'translate-checks-format', 'Parameter count' );
 320+ return true;
 321+ }
 322+ for ( $i = 0; $i < count($defArray); $i++ ) {
 323+ $defItems = array_map( 'trim', explode( ':', $defArray[$_] ) );
 324+ if ( !isset($traArray[$_]) ) return true;
 325+ $traItems = array_map( 'trim', explode( ':', $traArray[$_] ) );
 326+ if ( count($traItems) !== 2 ) return true;
 327+ if ( $traItems[1] !== $defItems[1] ) return true;
 328+ }
 329+ }
 330+ return false;
 331+ }
 332+
 333+ /**
307334 * Checks for translations not containing vars %xx% that are in the
308335 * definition.
309336 *
Index: trunk/extensions/Translate/README
@@ -33,6 +33,7 @@
3434 </code>
3535
3636 == Changes in version 10 ==
 37+* 2008-12-07 bug in export to file in web interface caused empty translations to be exported
3738 * 2008-11-30:1 added Special:LanguageStats for real-time translation statistics
3839 * 2008-11-24:2 fallback messages in the edit screen now have an edit link
3940 * 2008-11-24:1 added Special:Translations to show all translations of a message
Index: trunk/extensions/Translate/Translate.i18n.php
@@ -121,6 +121,7 @@
122122 <strong><nowiki>$1</nowiki></strong>',
123123 'translate-checks-plural' => 'Definition uses <nowiki>{{PLURAL:}}</nowiki> but translation does not.',
124124 'translate-checks-pagename' => 'Namespace changed from the definition',
 125+ 'translate-checks-format' => 'This translation does not follow the definition or has invalid syntax: $1',
125126
126127 'tog-translate-nonewsletter' => 'Do not send me e-mail newsletters (relevant only for users with a confirmed e-mail address)',
127128 'right-translate' => 'Edit using the translate interface',

Status & tagging log