Rename $wgExtensionMessagesDirs to $wgMessagesDirs
authorSiebrand Mazeland <s.mazeland@xs4all.nl>
Fri, 20 Dec 2013 15:53:57 +0000 (16:53 +0100)
committerSiebrand Mazeland <s.mazeland@xs4all.nl>
Fri, 20 Dec 2013 16:02:18 +0000 (17:02 +0100)
This is a better name, as we'll also be adding core and the installer i18n
to this.

Change-Id: Ic4c5849654aef54f3e5aea01a2d68e47d148b9bd

includes/DefaultSettings.php
includes/cache/LocalisationCache.php
maintenance/mergeMessageFileList.php

index 7522c55..f0c0ee5 100644 (file)
@@ -5934,13 +5934,13 @@ $wgExtensionFunctions = array();
  * in the core.
  *
  * Since MediaWiki 1.23, use of this variable to define messages is discouraged; instead, store
- * messages in JSON format and use $wgExtensionMessagesDirs. For setting other variables than
+ * messages in JSON format and use $wgMessagesDirs. For setting other variables than
  * $messages, $wgExtensionMessagesFiles should still be used.
  *
- * If there is an entry in $wgExtensionMessagesDirs with the same key as one in
+ * If there is an entry in $wgMessagesDirs with the same key as one in
  * $wgExtensionMessagesFiles, then any $messages variables set in the $wgExtensionMessagesFiles file
  * will be ignored. This means an extension that only provides messages can be backwards compatible
- * by using both $wgExtensionMessagesFiles and $wgExtensionMessagesDirs, and only one of the two
+ * by using both $wgExtensionMessagesFiles and $wgMessagesDirs, and only one of the two
  * will be used depending on what the version of MediaWiki supports.
  *
  * @par Example:
@@ -5960,12 +5960,12 @@ $wgExtensionMessagesFiles = array();
  *
  * @par Simple example:
  * @code
- *    $wgExtensionMessagesDirs['ConfirmEdit'] = __DIR__ . '/i18n';
+ *    $wgMessagesDirs['ConfirmEdit'] = __DIR__ . '/i18n';
  * @endcode
  *
  * @par Complex example:
  * @code
- *    $wgExtensionMessagesDirs['VisualEditor'] = array(
+ *    $wgMessagesDirs['VisualEditor'] = array(
  *        __DIR__ . '/i18n',
  *        __DIR__ . '/modules/ve-core/i18n',
  *        __DIR__ . '/modules/qunit/localisation',
@@ -5974,7 +5974,7 @@ $wgExtensionMessagesFiles = array();
  * @endcode
  * @since 1.23
  */
-$wgExtensionMessagesDirs = array();
+$wgMessagesDirs = array();
 
 /**
  * Array of files with list(s) of extension entry points to be used in
index 36de86c..41f24dc 100644 (file)
@@ -766,7 +766,7 @@ class LocalisationCache {
         * @throws MWException
         */
        public function recache( $code ) {
-               global $wgExtensionMessagesFiles, $wgExtensionMessagesDirs;
+               global $wgExtensionMessagesFiles, $wgMessagesDirs;
                wfProfileIn( __METHOD__ );
 
                if ( !$code ) {
@@ -840,7 +840,7 @@ class LocalisationCache {
                # like site-specific message overrides.
                wfProfileIn( __METHOD__ . '-extensions' );
                $allData = $initialData;
-               foreach ( $wgExtensionMessagesDirs as $dirs ) {
+               foreach ( $wgMessagesDirs as $dirs ) {
                        foreach ( (array)$dirs as $dir ) {
                                foreach ( $codeSequence as $csCode ) {
                                        $fileName = "$dir/$csCode.json";
@@ -860,9 +860,9 @@ class LocalisationCache {
                        $used = false;
 
                        foreach ( $data as $key => $item ) {
-                               if ( $key === 'messages' && isset( $wgExtensionMessagesDirs[$extension] ) ) {
+                               if ( $key === 'messages' && isset( $wgMessagesDirs[$extension] ) ) {
                                        # For backwards compatibility, ignore messages from extensions in
-                                       # $wgExtensionMessagesFiles that are also present in $wgExtensionMessagesDirs.
+                                       # $wgExtensionMessagesFiles that are also present in $wgMessagesDirs.
                                        # This allows extensions to use both and be backwards compatible.
                                        # Variables other than $messages still need to be supported though.
                                        continue;
@@ -885,7 +885,7 @@ class LocalisationCache {
 
                # Add cache dependencies for any referenced globals
                $deps['wgExtensionMessagesFiles'] = new GlobalDependency( 'wgExtensionMessagesFiles' );
-               $deps['wgExtensionMessagesDirs'] = new GlobalDependency( 'wgExtensionMessagesDirs' );
+               $deps['wgMessagesDirs'] = new GlobalDependency( 'wgMessagesDirs' );
                $deps['version'] = new ConstantDependency( 'MW_LC_VERSION' );
 
                # Add dependencies to the cache entry
index a7f5f44..a63c45b 100644 (file)
@@ -46,7 +46,7 @@ class MergeMessageFileList extends Maintenance {
                $this->addOption( 'list-file', 'A file containing a list of extension setup files, one per line.', false, true );
                $this->addOption( 'extensions-dir', 'Path where extensions can be found.', false, true );
                $this->addOption( 'output', 'Send output to this file (omit for stdout)', false, true );
-               $this->mDescription = 'Merge $wgExtensionMessagesFiles and $wgExtensionMessagesDirs from ' .
+               $this->mDescription = 'Merge $wgExtensionMessagesFiles and $wgMessagesDirs from ' .
                        ' various extensions to produce a single file listing all message files and dirs.';
        }
 
@@ -159,7 +159,7 @@ $s =
        "## This file is generated by mergeMessageFileList.php. Do not edit it directly.\n\n" .
        "if ( defined( 'MW_NO_EXTENSION_MESSAGES' ) ) return;\n\n" .
        '$wgExtensionMessagesFiles = ' . var_export( $wgExtensionMessagesFiles, true ) . ";\n\n" .
-       '$wgExtensionMessagesDirs = ' . var_export( $wgExtensionMessagesDirs, true ) . ";\n\n";
+       '$wgMessagesDirs = ' . var_export( $wgMessagesDirs, true ) . ";\n\n";
 
 $dirs = array(
        $IP,