Extension:AddMessages

From MediaWiki.org
Jump to navigation Jump to search
MediaWiki extensions manual
OOjs UI icon advanced.svg
AddMessages
Release status: beta
Implementation User interface
Description Allows admins to add or replace default messages using a global variable
Author(s) Ike Hecht (tosfostalk)
Latest version 0.2 (June 2014(2014-06))
MediaWiki 1.17+
PHP 5.3+
Database changes No
License GNU General Public License 2.0 or later
Download
Parameters
$wgAmMessages
Hooks used
LocalisationCacheRecache
Translate the AddMessages extension if it is available at translatewiki.net
Check usage and version matrix.

The AddMessages extension allows admins to add or replace default messages using a global variable. This can be set in LocalSettings.php. Other extensions could potentially set this variable or implement similar code in order to add messages. This used to be possible with $wgMessageCache->addMessage() but that feature has been removed. This feature is particularly useful in wikifarms, where it may not be practical to add a particular message to every individual site.

Installation[edit]

  • Download and place the file(s) in a directory called AddMessages in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    wfLoadExtension( 'AddMessages' );
    $wgAmMessages = array();
    
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

To users running MediaWiki 1.24 or earlier:

The instructions above describe the new way of installing this extension using wfLoadExtension() If you need to install this extension on these earlier versions (MediaWiki 1.24 and earlier), instead of wfLoadExtension( 'AddMessages' );, you need to use:

require_once "$IP/extensions/AddMessages/AddMessages.php";

Configuration parameters[edit]

$wgAmMessages
An array of message key and value pairs. Will take precedence over existing messages. Example:
$wgAmMessages = array( 'toolbox' => 'My Toolbox' );


See also[edit]