Jump to content

MediaWiki localization: Difference between revisions

From Meta, a Wikimedia project coordination wiki
Content deleted Content added
No edit summary
Line 30: Line 30:


=== With Mediawiki namespace ===
=== With Mediawiki namespace ===
'''Visit''' &nbsp; <nowiki>
'''Visit''' <nowiki>http://your.wiki.tld/wiki/index.php/Mediawiki:toolbox or http://your.wiki.tld/Mediawiki:toolbox</nowiki> (the latter with [[Rewrite Rules]]) and edit just as any other wikipage. A full list of all messages is available at <nowiki>http://your.wiki.tld/Special:Allmessages</nowiki> (older versions of Mediawiki: <nowiki>http://your.wiki.tld/Mediawiki:All_messages</nowiki>, you will need sysop status).
http://your.wiki.tld/wiki/index.php/Mediawiki:toolbox &nbsp; or &nbsp;
http://your.wiki.tld/Mediawiki:toolbox</nowiki> &nbsp;
(the latter with [[Rewrite Rules]]) and edit just as any other wikipage. A full list of all messages is available at <nowiki>http://your.wiki.tld/Special:Allmessages</nowiki> (older versions of Mediawiki: <nowiki>http://your.wiki.tld/Mediawiki:All_messages</nowiki>, you will need sysop status).


=== LanguageXx.php version ===
=== LanguageXx.php version ===

Revision as of 06:21, 2 September 2005

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 DefaultsSettings.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.

Considerations

  • Using only LanguageXx.php was ~30% faster than the Mediawiki namespace in 1.2.x, but this overhead has been largely eliminated by caching the messages in 1.3.x.
  • Changes to LanguageXx.php can benefit new users of the software, changes in the MediaWiki namespace are local and will only benefit the local installation.
  • There are unresolved bugs in the memcached/Tugela Cache implementation in use by Wikimedia that occasionally makes the software resort to the LanguageXx.php file; it is thus wise to regularly update it.
  • The LanguageXx.php file will be used on new installations, also new Wikimedia installations.

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:

  1. Set $wgUseDatabaseMessages = false; in LocalSettings.php (line is in DefaultSettings.php as of 1.4x, but copy them to LocalSettings.php) to disable the support for the MediaWiki namespace. 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.
  2. 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 .

Example message: toolbox

With Mediawiki namespace

Visit   http://your.wiki.tld/wiki/index.php/Mediawiki:toolbox   or   http://your.wiki.tld/Mediawiki:toolbox   (the latter with Rewrite Rules) 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).

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