r86812 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86811‎ | r86812 | r86813 >
Date:11:17, 24 April 2011
Author:krinkle
Status:deferred
Tags:
Comment:
fix comments; implement TsIntuition->listMsgs method
Modified paths:
  • /trunk/tools/ToolserverI18N/ToolStart.php (modified) (history)
  • /trunk/tools/ToolserverI18N/TsIntuition.php (modified) (history)

Diff [purge]

Index: trunk/tools/ToolserverI18N/TsIntuition.php
@@ -56,7 +56,7 @@
5757 private $paramNames = array( 'userlang' => 'userlang' );
5858
5959 // Here everything will be stored as arrays in arrays
60 - // Such as: $messageBlob['Textdomain']['messagename']['langcode'] = 'Message string';
 60+ // Such as: $messageBlob['Textdomain']['langcode']['messagename'] = 'Message string';
6161 private $messageBlob = array();
6262
6363 // All loaded text domains and (if available) their information (such as url) in an array
@@ -512,7 +512,11 @@
513513 }
514514 }
515515
 516+ public function listMsgs( $domain ) {
 517+ return array_keys( $this->messageBlob[$domain]['en'] );
 518+ }
516519
 520+
517521 /* Lang functions
518522 * ------------------------------------------------- */
519523
@@ -599,6 +603,7 @@
600604 * Load a textdomain (if not loaded already).
601605 *
602606 * @param $domain string Name of the textdomain (case-insensitive)
 607+ * @return False on error, (normalized) domainname if success.
603608 */
604609 public function loadTextdomain( $domain ) {
605610
@@ -610,8 +615,13 @@
611616 // Sanatize domainnames (case-insensitive)
612617 $domain = ucfirst( strtolower( $domain ) );
613618
614 - // Don't load if already loaded or unregistered
615 - if ( isset( $this->loadedTextdomains[$domain] ) || !isset( $this->registeredTextdomains[$domain] ) ) {
 619+ // Don't load if already loaded
 620+ if ( isset( $this->loadedTextdomains[$domain] ) ) {
 621+ return $domain;
 622+ }
 623+
 624+ // Error out if unregistered
 625+ if ( !isset( $this->registeredTextdomains[$domain] ) ) {
616626 return false;
617627 }
618628
@@ -626,7 +636,8 @@
627637 // Load it
628638 $load = $this->loadTextdomainFromFile( $path, $domain );
629639
630 - return !!$load;
 640+ // Return (normalized) domainname or false
 641+ return !!$load ? $domain : false;
631642
632643 }
633644
Index: trunk/tools/ToolserverI18N/ToolStart.php
@@ -10,7 +10,7 @@
1111 * This file loads everything the individual tools need.
1212 */
1313
14 -// This is a valid entry, define true
 14+// This is a valid entry, define
1515 define( 'TS_INTUITION', __DIR__ );
1616
1717 // Local override

Status & tagging log