r83043 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r83042‎ | r83043 | r83044 >
Date:20:59, 1 March 2011
Author:roberthl
Status:deferred
Tags:
Comment:
Translate: Sort message keys in Python FFS format alphabetically.
Modified paths:
  • /trunk/extensions/Translate/FFS.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/FFS.php
@@ -1107,13 +1107,18 @@
11081108
11091109 protected function writeBlock( MessageCollection $collection ) {
11101110 $block = '';
 1111+ $messages = array();
11111112 foreach( $collection as $message ) {
11121113 if( $message->translation() == '' ) continue;
11131114 $translation = str_replace( '\\', '\\\\', $message->translation() );
11141115 $translation = str_replace( '\'', '\\\'', $translation );
11151116 $translation = str_replace( "\n", '\n', $translation );
1116 - $block .= "\t\t'{$message->key()}': u'{$translation}',\n";
 1117+ $messages[$message->key()] = $translation;
11171118 }
 1119+ ksort( $messages );
 1120+ foreach( $messages as $key => $translation ) {
 1121+ $block .= "\t\t'{$key}': u'{$translation}',\n";
 1122+ }
11181123 return $block;
11191124 }
11201125

Status & tagging log