http://www.mediawiki.org/wiki/Special:Code/MediaWiki/72849
Revision: 72849
Author: nikerabbit
Date: 2010-09-12 10:39:05 +0000 (Sun, 12 Sep 2010)
Log Message:
-----------
Read pot and previous translation file if available and use plural header form
latter if avaiblable
Modified Paths:
--------------
trunk/extensions/Translate/Groups.php
trunk/extensions/Translate/ffs/Gettext.php
Modified: trunk/extensions/Translate/Groups.php
===================================================================
--- trunk/extensions/Translate/Groups.php 2010-09-12 10:29:38 UTC (rev
72848)
+++ trunk/extensions/Translate/Groups.php 2010-09-12 10:39:05 UTC (rev
72849)
@@ -209,9 +209,13 @@
$messages = array();
$cache = new MessageGroupCache( $this );
-
- foreach ( $cache->getKeys() as $key ) {
- $messages[$key] = $cache->get( $key );
+ if ( !$cache->exists() ) {
+ wfWarn( "By-passing message group cache" );
+ $messages = $this->load( 'en' );
+ } else {
+ foreach ( $cache->getKeys() as $key ) {
+ $messages[$key] = $cache->get( $key );
+ }
}
$definitions = new MessageDefinitions( $namespace, $messages );
Modified: trunk/extensions/Translate/ffs/Gettext.php
===================================================================
--- trunk/extensions/Translate/ffs/Gettext.php 2010-09-12 10:29:38 UTC (rev
72848)
+++ trunk/extensions/Translate/ffs/Gettext.php 2010-09-12 10:39:05 UTC (rev
72849)
@@ -625,7 +625,9 @@
// WRITE
//
protected function writeReal( MessageCollection $collection ) {
- $output = $this->doHeader( $collection );
+ $pot = $this->read( 'en' );
+ $template = $this->read( $collection->code );
+ $output = $this->doGettextHeader( $collection, $template );
$mangler = $this->group->getMangler();
$messages = array();
@@ -646,7 +648,7 @@
return $output;
}
- protected function doHeader( MessageCollection $collection ) {
+ protected function doGettextHeader( MessageCollection $collection,
$template ) {
global $wgSitename, $wgServer;
$code = $collection->code;
$name = TranslateUtils::getLanguageName( $code );
@@ -669,10 +671,10 @@
/// @todo twn specific
$portal = Title::makeTitle( NS_PORTAL, $code )->getFullUrl();
- $specs = array();
+ $specs = isset( $template['HEADERS'] ) ? $template['HEADERS'] :
array();
$specs['Project-Id-Version'] = $this->group->getLabel();
- $specs['Report-Msgid-Bugs'] = $wgSitename;
+ $specs['Report-Msgid-Bugs-To'] = $wgSitename;
$specs['POT-Creation-Date'] = self::formatTime(
$this->getPotTime() );
$specs['PO-Revision-Date'] = self::formatTime( wfTimestampNow()
);
$specs['Language-Team'] = "$name <$portal>";
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs