Reputation: 14717
I am learning MediaWiki 1.31.1 and hope to change default interface strings. For example, out-of-the-box signup page displays this:
Email address (optional)
I would like to show (remove optional)
Email address
I am able to hack the MediaWiki string file (/languages/i18n/en.json) and make changes there. Any better way?
Upvotes: 0
Views: 325
Reputation: 28160
Append uselang=qqx
to the URL to see message names instead of the text of the messages: https://en.wikipedia.org/wiki/Special:CreateAccount?uselang=qqx
You should only see the (optional)
part though if you configured email to be optional, so I'm not sure the message text is your real problem.
Upvotes: 2
Reputation: 31
If you are running a multilingual wiki, or if your users are likely to use different interface languages (such as when using the Universal Language Selector extension to automatically use visitor's preferred language), then you should use the MessageCache::get hook so that the customization is used in all languages. Otherwise user's using a different interface language will not see the customization.
It's used like this:
LocalSettings.php:
$wgHooks['MessageCache::get'][] = function ( &$key ) {
$keys = [ // The list of messages you want to customize
'prefs-help-realname',
'createacct-realname',
];
if ( in_array( $key, $keys, true ) ) {
$key = "myprefix-$key";
}
};
Then you need to edit https://example.org/wiki/MediaWiki:myprefix-key
(replace with your wiki domain and key with the original message key (which you can find with uselang=qqx
).
Upvotes: 3
Reputation: 611
Any language string can also be edited by going to the page MediaWiki:name-of-language-string on your wiki and editing that.
Upvotes: 0