r93752 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93751‎ | r93752 | r93753 >
Date:14:28, 2 August 2011
Author:siebrand
Status:deferred
Tags:
Comment:
Do not export TRANSLATE_FUZZY in PythonSingleFFS class.
Modified paths:
  • /trunk/extensions/Translate/FFS.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/FFS.php
@@ -1078,7 +1078,6 @@
10791079 return array( 'MESSAGES' => self::$data[$this->group->getId()][$code] );
10801080 }
10811081
1082 -
10831082 public function write( MessageCollection $collection ) {
10841083 if ( $this->fw === null ) {
10851084 $sourceLanguage = $this->group->getSourceLanguage();
@@ -1098,7 +1097,10 @@
10991098 if ( !$ok ) return;
11001099
11011100 $authors = $this->doAuthors( $collection );
1102 - if ( $authors != '' ) fwrite( $this->fw, "$authors" );
 1101+ if ( $authors != '' ) {
 1102+ fwrite( $this->fw, "$authors" );
 1103+ }
 1104+
11031105 fwrite( $this->fw, "\t'{$collection->code}': {\n" );
11041106 fwrite( $this->fw, $this->writeBlock( $collection ) );
11051107 fwrite( $this->fw, "\t},\n" );
@@ -1117,17 +1119,22 @@
11181120 protected function writeBlock( MessageCollection $collection ) {
11191121 $block = '';
11201122 $messages = array();
 1123+
11211124 foreach ( $collection as $message ) {
11221125 if ( $message->translation() == '' ) continue;
11231126 $translation = str_replace( '\\', '\\\\', $message->translation() );
11241127 $translation = str_replace( '\'', '\\\'', $translation );
11251128 $translation = str_replace( "\n", '\n', $translation );
 1129+ $translation = str_replace( TRANSLATE_FUZZY, '', $translation );
11261130 $messages[$message->key()] = $translation;
11271131 }
 1132+
11281133 ksort( $messages );
 1134+
11291135 foreach ( $messages as $key => $translation ) {
11301136 $block .= "\t\t'{$key}': u'{$translation}',\n";
11311137 }
 1138+
11321139 return $block;
11331140 }
11341141
@@ -1137,8 +1144,10 @@
11381145 // Read authors.
11391146 $fr = fopen( $this->group->getSourceFilePath( $collection->code ), 'r' );
11401147 $authors = array();
 1148+
11411149 while ( !feof( $fr ) ) {
11421150 $line = fgets( $fr );
 1151+
11431152 if ( strpos( $line, "\t# Author:" ) === 0 ) {
11441153 $authors[] = trim( substr( $line, strlen( "\t# Author: " ) ) );
11451154 } elseif ( $line === "\t'{$collection->code}': {\n" ) {
@@ -1147,6 +1156,7 @@
11481157 $authors = array();
11491158 }
11501159 }
 1160+
11511161 $authors2 = $collection->getAuthors();
11521162 $authors2 = $this->filterAuthors( $authors2, $collection->code );
11531163 $authors = array_unique( array_merge( $authors, $authors2 ) );
@@ -1161,7 +1171,7 @@
11621172 public function __destruct() {
11631173 if ( $this->fw !== null ) {
11641174 fwrite( $this->fw, "}" );
1165 - fclose( $this->fw );
 1175+ fclose( $this->fw );
11661176 }
11671177 }
11681178 }

Status & tagging log