Index: trunk/phase3/includes/api/ApiQueryAllmessages.php |
— | — | @@ -65,7 +65,7 @@ |
66 | 66 | |
67 | 67 | // Determine which messages should we print |
68 | 68 | if ( in_array( '*', $params['messages'] ) ) { |
69 | | - $message_names = array_keys( Language::getMessagesFor( 'en' ) ); |
| 69 | + $message_names = Language::getMessageKeysFor( $langObj->getCode() ); |
70 | 70 | sort( $message_names ); |
71 | 71 | $messages_target = $message_names; |
72 | 72 | } else { |
Index: trunk/phase3/includes/specials/SpecialAllmessages.php |
— | — | @@ -249,6 +249,7 @@ |
250 | 250 | * @param bool $foreign Whether the $langcode is not the content language |
251 | 251 | */ |
252 | 252 | public static function getCustomisedStatuses( $messageNames, $langcode = 'en', $foreign = false ) { |
| 253 | + // FIXME: This function should be moved to Language:: or something. |
253 | 254 | wfProfileIn( __METHOD__ . '-db' ); |
254 | 255 | |
255 | 256 | $dbr = wfGetDB( DB_SLAVE ); |
Index: trunk/phase3/languages/Language.php |
— | — | @@ -3371,7 +3371,8 @@ |
3372 | 3372 | |
3373 | 3373 | /** |
3374 | 3374 | * Get all messages for a given language |
3375 | | - * WARNING: this may take a long time |
| 3375 | + * WARNING: this may take a long time. If you just need all message *keys* |
| 3376 | + * but need the *contents* of only a few messages, consider using getMessageKeysFor(). |
3376 | 3377 | * |
3377 | 3378 | * @param $code string |
3378 | 3379 | * |
— | — | @@ -3392,6 +3393,16 @@ |
3393 | 3394 | static function getMessageFor( $key, $code ) { |
3394 | 3395 | return self::getLocalisationCache()->getSubitem( $code, 'messages', $key ); |
3395 | 3396 | } |
| 3397 | + |
| 3398 | + /** |
| 3399 | + * Get all message keys for a given language. This is a faster alternative to |
| 3400 | + * array_keys( Language::getMessagesFor( $code ) ) |
| 3401 | + * @param $code string Language code |
| 3402 | + * @return array of message keys (strings) |
| 3403 | + */ |
| 3404 | + static function getMessageKeysFor( $code ) { |
| 3405 | + return self::getLocalisationCache()->getSubItemList( $code, 'messages' ); |
| 3406 | + } |
3396 | 3407 | |
3397 | 3408 | /** |
3398 | 3409 | * @param $talk |