MediaWiki localization

From Meta, a Wikimedia project coordination wiki
This is an archived version of this page, as edited by 212.238.156.25 (talk) at 08:53, 13 October 2005 (→‎With Mediawiki namespace). It may differ significantly from the current version.

DO NOT EDIT THIS PAGE

This is a Help Page on the WikiMedia Internet Site, not on your local machine. It is designed to assist you in customising your own site, and should not be used as a testbed for your design.

If your DefaultSettings.php file shows the following line it means that you use Mediawiki Namespace:

$wgUseDatabaseMessages = true;
  • true -> Mediawiki Namespace
  • false -> LanguageXx.php

Since the Language.php file is in English, the LanguageEn.php file just refers to Language.php.

Updating messages/changing language

At install time, the interface messages are imported to the database so you can customize them. (See MediaWiki namespace). If you then change the language by setting something like $wgLanguageCode = "de"; in LocalSettings.php or want to get a fresh copy of the default messages, you can do one of two things:

  • Set $wgUseDatabaseMessages = false; in LocalSettings.php to disable the support for the MediaWiki namespace. (The line is in DefaultSettings.php as of 1.4x, but copy it to LocalSettings.php.) This means you'll have to customize things by hand in LanguageXx.php, will lose your changes at the next upgrade if you don't carefully merge, and can't use template messages for other purposes.

OR

  • Run maintenance/rebuildMessages.php to re-import the messages. This needs to run from the command line, and you must set up an AdminSettings.php (see AdminSettings.sample; it's easy). If you don't have command-line access, you may need to hack up the scripts; the maintenance scripts are not designed to run from the web since it's not safe to leave them exposed that way.
    • cd maintenance
    • php rebuildMessages.php --rebuild
    • NOTE: To get maintenance/rebuildMessages.php to run, you need make sure that "register_argc_argv" is "On" in php.ini .

Changing parameters contained in the Language.php file

The Language.php file contains other parameters besides messages. For instance, in this file you can modify whether or not the "Community portal" link appears, and you can get the help link to point to the meta.wikimedia site instead of the empty set of help pages on your local installation (set the 'helppage' parameter to 'http://meta.wikimedia.org/wiki/Help:Contents'). If you make changes to the Language.php file, they will not take effect unless either you run rebuildMessages.php afterwards or you have previously set $wgUseDatabaseMessages to false.

Example message: toolbox

With Mediawiki namespace

Visit   http://your.wiki.tld/wiki/index.php/Mediawiki:toolbox   or   http://your.wiki.tld/index.php/Mediawiki:toolbox   (the latter with Rewrite Rules) or even   http://your.wiki.tld/wiki/index.php?title=Mediawiki:toolbox  and edit just as any other wikipage. A full list of all messages is available at http://your.wiki.tld/Special:Allmessages (older versions of Mediawiki: http://your.wiki.tld/Mediawiki:All_messages, you will need sysop status).



Sometheing

--212.238.156.25 08:53, 13 October 2005 (UTC)[reply]

noh iryd

Media:Example.ogg


[Headline text]

link title

Link title

[[

LanguageXx.php version

Change the toolbox line in languages/LanguageXx.php (Xx corresponding to the ISO code of the language you have chosen) to :

"toolbox" => "my toolbox text",

<Next page: Configuring Interwiki links >

Documentation for translators (iii)

This section is meant as guidance for some general aspects of translating the Language.php file to another language (LanguageXx.php) and to some messages that are not straightforward to translate.

Basic coding

There are some basic coding rules that are helpful to know to understand the code:

  • Quoting: All strings (name of the message, content of the message) must be contained in quotes. "Double quotes" means everything within the quotes will be checked by PHP for variables and such stuff ($1, $2, $3, etc. and \n for example), while with single quotes PHP can work a little bit faster because it will not check for such things. This should indicate that all messages with such variables would have to be contained in "double quotes", but this does not seem to be the case with LanguageXx.php anymore.

General considerations

  • If you are making a UTF-8 localization, this line will have to be placed somewhere in the beginning (or end) of the LanguageXx.php file:
require_once( "LanguageUtf8.php" );
  • "-" means "don't show this". Can be used to disable displaying 'disclaimers', 'currentevents', and 'portal', for example (see Wikitech posting). This does not currently work to prevent Special pages from showing up in the list of special pages though.

Message documentation

  • 'categoryarticlecount1': See 'subcategorycount1'.
  • 'subcategorycount1': This is the same as 'subcategorycount', but in singular form. This way of indicating singular form is used elsewhere too danomabn.
  • 'sitesubtitle': This message is now hidden by default, but can be made visible by editing the site's monobook.css.

See also