Index: trunk/extensions/Translate/Translate.php |
— | — | @@ -11,7 +11,7 @@ |
12 | 12 | * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
13 | 13 | */ |
14 | 14 | |
15 | | -define( 'TRANSLATE_VERSION', '7.9' ); |
| 15 | +define( 'TRANSLATE_VERSION', '7.10' ); |
16 | 16 | |
17 | 17 | $wgExtensionCredits['specialpage'][] = array( |
18 | 18 | 'name' => 'Translate', |
Index: trunk/extensions/Translate/TranslateTasks.php |
— | — | @@ -373,7 +373,7 @@ |
374 | 374 | } |
375 | 375 | |
376 | 376 | public function output() { |
377 | | - global $IP; |
| 377 | + global $IP, $wgServer, $wgTranslateDocumentationLanguageCode; |
378 | 378 | |
379 | 379 | $lang = Language::factory( 'en' ); |
380 | 380 | |
— | — | @@ -385,9 +385,10 @@ |
386 | 386 | |
387 | 387 | $headers = array(); |
388 | 388 | $headers['Project-Id-Version'] = 'MediaWiki ' . SpecialVersion::getVersion(); |
389 | | - $headers['Report-Msgid-Bugs-To'] = 'Bugzilla?'; |
| 389 | + // TODO: make this customisable or something |
| 390 | + $headers['Report-Msgid-Bugs-To'] = $wgServer; |
390 | 391 | // TODO: sprintfDate doesn't support any time zone flags |
391 | | - $headers['POT-Creation-Date'] = $lang->sprintfDate( 'xnY-xnm-xnd xnH:xni:xns O', $now ); |
| 392 | + $headers['POT-Creation-Date'] = $lang->sprintfDate( 'xnY-xnm-xnd xnH:xni:xns+0000', $now ); |
392 | 393 | $headers['Language-Team'] = TranslateUtils::getLanguageName( $this->options->getLanguage() ); |
393 | 394 | $headers['Content-Type'] = 'text-plain; charset=UTF-8'; |
394 | 395 | $headers['Content-Transfer-Encoding'] = '8bit'; |
— | — | @@ -400,14 +401,9 @@ |
401 | 402 | $headerlines[] = "$key: $value\n"; |
402 | 403 | } |
403 | 404 | |
404 | | - |
405 | | - $out .= "# Translation of $label to $languageName\n# This is an experimental feature\n"; |
| 405 | + $out .= "# Translation of $label to $languageName\n"; |
406 | 406 | $out .= self::formatmsg( '', $headerlines ); |
407 | 407 | |
408 | | - |
409 | | - // Todo: move to MessageGroup |
410 | | - require( $IP . '/maintenance/language/messages.inc' ); |
411 | | - |
412 | 408 | foreach ( $this->messages as $key => $m) { |
413 | 409 | $flags = array(); |
414 | 410 | |
— | — | @@ -430,9 +426,10 @@ |
431 | 427 | $flags[] = 'fuzzy'; |
432 | 428 | } |
433 | 429 | |
434 | | - $comments = array( $key ); |
435 | | - if ( isset( $wgMessageComments[$key] ) ) { |
436 | | - $comments[] = $wgMessageComments[$key]; |
| 430 | + $comments = ''; |
| 431 | + if ( $wgTranslateDocumentationLanguageCode ) { |
| 432 | + $documentation = TranslateUtils::getMessageContent( $key, $wgTranslateDocumentationLanguageCode ); |
| 433 | + if ( $documentation ) $comments = $documentation; |
437 | 434 | } |
438 | 435 | |
439 | 436 | $out .= self::formatcomments( $comments, $flags ); |
— | — | @@ -453,10 +450,7 @@ |
454 | 451 | private static function formatcomments( $comments = false, $flags = false ) { |
455 | 452 | $output = array(); |
456 | 453 | if ( $comments ) { |
457 | | - if ( !is_array( $comments ) ) { |
458 | | - $comments = array( $comments ); |
459 | | - } |
460 | | - $output[] = '#. ' . implode( "\n#. ", $comments ); |
| 454 | + $output[] = '#. ' . implode( "\n#. ", explode( "\n", $comments ) ); |
461 | 455 | } |
462 | 456 | |
463 | 457 | if ( $flags ) { |
Index: trunk/extensions/Translate/README |
— | — | @@ -46,6 +46,8 @@ |
47 | 47 | * New variable $wgTranslateCC for adding custom groups |
48 | 48 | * WikiMessageGroup class, which is easy to use class for defining a message group for wiki's custom user interface elements |
49 | 49 | * Array keys in $wgTranslateEC and $wgTranslateAC are not used for alphabetical sorting only. MessageGroup::$id and MessageGroup::getId() are used for everything else. |
| 50 | +* Export documentation messages as "extracted comments" in po export |
| 51 | +* Import fuzzy messages as fuzzy in po import |
50 | 52 | |
51 | 53 | == Changes in version 7 == |
52 | 54 | * Released 2007-12-29 |
Index: trunk/extensions/Translate/poimport.php |
— | — | @@ -1,4 +1,11 @@ |
2 | 2 | <?php |
| 3 | +/** |
| 4 | + * Imports po files exported from Special:Translate back. |
| 5 | + * |
| 6 | + * @author Niklas Laxström |
| 7 | + * @copyright Copyright © 2007-2008 Niklas Laxström |
| 8 | + * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
| 9 | + */ |
3 | 10 | |
4 | 11 | $optionsWithArgs = array( 'file', 'user' ); |
5 | 12 | |
— | — | @@ -146,6 +153,11 @@ |
147 | 154 | continue; |
148 | 155 | } |
149 | 156 | |
| 157 | + // Fuzzy messages |
| 158 | + if ( preg_match( '/^#, fuzzy$/m', $section ) ) { |
| 159 | + $translation = TRANSLATE_FUZZY . $translation; |
| 160 | + } |
| 161 | + |
150 | 162 | if ( $translation !== $contents[$key]->translation ) { |
151 | 163 | echo "Translation of $key differs:\n$translation\n\n"; |
152 | 164 | $changes["$key/$code"] = $translation; |