https://www.mediawiki.org/wiki/Special:Code/MediaWiki/101994
Revision: 101994
Author: nikerabbit
Date: 2011-11-04 14:41:45 +0000 (Fri, 04 Nov 2011)
Log Message:
-----------
Handle better the case when no groups have been configured - bug 31633.
Modified Paths:
--------------
trunk/extensions/Translate/MessageGroups.php
trunk/extensions/Translate/Translate.i18n.php
trunk/extensions/Translate/specials/SpecialTranslate.php
Modified: trunk/extensions/Translate/MessageGroups.php
===================================================================
--- trunk/extensions/Translate/MessageGroups.php 2011-11-04 14:28:05 UTC
(rev 101993)
+++ trunk/extensions/Translate/MessageGroups.php 2011-11-04 14:41:45 UTC
(rev 101994)
@@ -1152,6 +1152,7 @@
}
// Sort top-level groups according to labels, not ids
+ $labels = array();
foreach ( $structure as $id => $data ) {
// Either it is a group itself, or the first group of
the array
$nid = is_array( $data ) ? key( $data ) : $id;
Modified: trunk/extensions/Translate/Translate.i18n.php
===================================================================
--- trunk/extensions/Translate/Translate.i18n.php 2011-11-04 14:28:05 UTC
(rev 101993)
+++ trunk/extensions/Translate/Translate.i18n.php 2011-11-04 14:41:45 UTC
(rev 101994)
@@ -19,6 +19,7 @@
'translate-grouplisting' => 'This is the list of all translatable
groups.
Click the message group name to view a list of untranslated messages.',
+ 'translate-grouplisting-empty' => 'No message groups have been
configured for translation.',
'translate-task-view' => 'View all messages from',
'translate-task-untranslated' => 'View all untranslated
messages from',
Modified: trunk/extensions/Translate/specials/SpecialTranslate.php
===================================================================
--- trunk/extensions/Translate/specials/SpecialTranslate.php 2011-11-04
14:28:05 UTC (rev 101993)
+++ trunk/extensions/Translate/specials/SpecialTranslate.php 2011-11-04
14:41:45 UTC (rev 101994)
@@ -60,7 +60,7 @@
$errors = array();
if ( $this->options['group'] === '' ) {
- $wgOut->addHTML( $this->groupInformation() );
+ $this->groupInformation();
return;
}
@@ -404,15 +404,21 @@
}
public function groupInformation() {
- $out = '';
+ global $wgOut;
$structure = MessageGroups::getGroupStructure();
+ if ( !$structure ) {
+ $wgOut->addWikiMsg( 'translate-grouplisting-empty' );
+ return;
+ }
+ $wgOut->addWikiMsg( 'translate-grouplisting' );
+
+ $out = '';
foreach ( $structure as $blocks ) {
$out .= $this->formatGroupInformation( $blocks );
}
- $header = wfMsgExt( 'translate-grouplisting', 'parse' );
- return $header . "\n" . Html::rawElement( 'table', array(
'class' => 'mw-sp-translate-grouplist wikitable' ), $out );
+ $wgOut->addHtml( Html::rawElement( 'table', array( 'class' =>
'mw-sp-translate-grouplist wikitable' ), $out ) );
}
public function formatGroupInformation( $blocks, $level = 2 ) {
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs