Call Linker methods statically
[lhc/web/wiklou.git] / includes / api / ApiQueryAllmessages.php
index d900d54..ddd8491 100644 (file)
@@ -66,6 +66,17 @@ class ApiQueryAllmessages extends ApiQueryBase {
                // Determine which messages should we print
                if ( in_array( '*', $params['messages'] ) ) {
                        $message_names = Language::getMessageKeysFor( $langObj->getCode() );
+                       if ( $params['includelocal'] ) {
+                               global $wgLanguageCode;
+                               $message_names = array_unique( array_merge(
+                                       $message_names,
+                                       // Pass in the content language code so we get local messages that have a
+                                       // MediaWiki:msgkey page. We might theoretically miss messages that have no
+                                       // MediaWiki:msgkey page but do have a MediaWiki:msgkey/lang page, but that's
+                                       // just a stupid case.
+                                       MessageCache::singleton()->getAllMessageKeys( $wgLanguageCode )
+                               ) );
+                       }
                        sort( $message_names );
                        $messages_target = $message_names;
                } else {
@@ -207,6 +218,7 @@ class ApiQueryAllmessages extends ApiQueryBase {
                        ),
                        'enableparser' => false,
                        'nocontent' => false,
+                       'includelocal' => false,
                        'args' => array(
                                ApiBase::PARAM_ISMULTI => true,
                                ApiBase::PARAM_ALLOW_DUPLICATES => true,
@@ -235,6 +247,9 @@ class ApiQueryAllmessages extends ApiQueryBase {
                        'enableparser' => array( 'Set to enable parser, will preprocess the wikitext of message',
                                                        'Will substitute magic words, handle templates etc.' ),
                        'nocontent' => 'If set, do not include the content of the messages in the output.', 
+                       'includelocal' => array( "Also include local messages, i.e. messages that don't exist in the software but do exist as a MediaWiki: page.",
+                                                       "This lists all MediaWiki: pages, so it will also list those that aren't 'really' messages such as Common.js",
+                       ),
                        'title' => 'Page name to use as context when parsing message (for enableparser option)',
                        'args' => 'Arguments to be substituted into message',
                        'prefix' => 'Return messages with this prefix',