Index: trunk/extensions/Translate/FFS.php |
— | — | @@ -1071,6 +1071,7 @@ |
1072 | 1072 | if( !isset( $this->data[$code] ) ) $this->data[$code] = array(); |
1073 | 1073 | return array( 'MESSAGES' => $this->data[$code] ); |
1074 | 1074 | } |
| 1075 | + |
1075 | 1076 | |
1076 | 1077 | public function write( MessageCollection $collection ) { |
1077 | 1078 | if( $this->fw === null ) { |
— | — | @@ -1087,7 +1088,7 @@ |
1088 | 1089 | if( !$ok ) return; |
1089 | 1090 | |
1090 | 1091 | $authors = $this->doAuthors($collection); |
1091 | | - if( $authors != '' ) fwrite( $this->fw, "\t$authors" ); |
| 1092 | + if( $authors != '' ) fwrite( $this->fw, "$authors" ); |
1092 | 1093 | fwrite( $this->fw, "\t'{$collection->code}': {\n" ); |
1093 | 1094 | fwrite( $this->fw, $this->writeBlock( $collection ) ); |
1094 | 1095 | fwrite( $this->fw, "\t},\n" ); |
— | — | @@ -1096,8 +1097,8 @@ |
1097 | 1098 | public function writeIntoVariable( MessageCollection $collection ) { |
1098 | 1099 | return <<<PHP |
1099 | 1100 | # -*- coding: utf-8 -*- |
1100 | | -{$this->doAuthors($collection)}msg = { |
1101 | | -\t'{$collection->code}': { |
| 1101 | +msg = { |
| 1102 | +{$this->doAuthors($collection)}\t'{$collection->code}': { |
1102 | 1103 | {$this->writeBlock( $collection )}\t} |
1103 | 1104 | } |
1104 | 1105 | PHP; |
— | — | @@ -1116,11 +1117,26 @@ |
1117 | 1118 | |
1118 | 1119 | protected function doAuthors( MessageCollection $collection ) { |
1119 | 1120 | $output = ''; |
1120 | | - $authors = $collection->getAuthors(); |
1121 | | - $authors = $this->filterAuthors( $authors, $collection->code ); |
1122 | 1121 | |
| 1122 | + // Read authors. |
| 1123 | + $fr = fopen( $this->group->getSourceFilePath( $collection->code ), 'r' ); |
| 1124 | + $authors = array(); |
| 1125 | + while( !feof( $fr ) ) { |
| 1126 | + $line = fgets( $fr ); |
| 1127 | + if( strpos( $line, "\t# Author:" ) === 0 ) { |
| 1128 | + $authors[] = trim( substr( $line, strlen( "\t# Author: " ) ) ); |
| 1129 | + } elseif( $line === "\t'{$collection->code}': {\n" ) { |
| 1130 | + break; |
| 1131 | + } else { |
| 1132 | + $authors = array(); |
| 1133 | + } |
| 1134 | + } |
| 1135 | + $authors2 = $collection->getAuthors(); |
| 1136 | + $authors2 = $this->filterAuthors( $authors2, $collection->code ); |
| 1137 | + $authors = array_unique( array_merge( $authors, $authors2 ) ); |
| 1138 | + |
1123 | 1139 | foreach ( $authors as $author ) { |
1124 | | - $output .= "# Author: $author\n"; |
| 1140 | + $output .= "\t# Author: $author\n"; |
1125 | 1141 | } |
1126 | 1142 | |
1127 | 1143 | return $output; |