Localisation

The MediaWiki interface can be fully translated to any language. This page will explain to you how it was done before, how it should be done now and how you can help the translation effort.

History
With MediaWiki 1.3.0 a new system has been set up for localizing MediaWiki. Instead of editing the language file and asking developers to apply the change, users can now edit the interface strings directly from their wikis. This is the system in use as of August 2005. People can find the message they want to translate in Special:Allmessages and then edit the relevant string in the MediaWiki: namespace. Once edited, these changes are live. There is no more need to request an update, and wait for developers to check and update the file.

The system is great for Wikipedia projects; however a side effect is that the MediaWiki language files shipped with the software are no longer quite up-to-date, and it is harder for developers to keep the files on meta in sync with the real language files.

As the default language files do not provide enough translated material, we face two problems:
 * 1) New Wikimedia projects created in a language which have not been updated for a long time, need a total retranslation of the interface.
 * 2) Other users of MediaWiki [not Wikimedia projects] are left with untranslated interfaces (especially for unusual languages)

Betawiki
Betawiki supports in-wiki translation of the complete interface, as well as .po export for offline translation using a CAT tool. If you would like to have nothing to do with all the technicalities of editing files, subversion, creating patches, and so on, this may be the solution for you. Please visit Betawiki, create an account and request translator privileges.

Getting latest file
You will have to get the latest language file using the subversion repository (since April 2006) :

svn co http://svn.wikimedia.org/svnroot/mediawiki/trunk/phase3

See a little guide by MediaWiki developers for help.


 * DO NOT use the web svn tool, as it probably does not output files with the proper encoding (more on that below).
 * DO NOT use the language files from Meta: website, they are totally outdated.

If you are creating a new language file, you should not just copy and paste Language.php. Instead have a look at some other files such as LanguageDe.php. The most important thing is probably the $wgAllMessagesXX array in MessagesXX.php, which contains all translateable messages.

Modifying files
Once you have downloaded the latest files, you will find them in the languages directory. The files are encoded using utf-8, so you will need an editor with unicode capabilities (see Text editors with unicode support). You want to use tabulations for indenting, not spaces.


 * Make small changes rather than large ones if possible, Large patches that change two thousand lines are harder to review, and make it less likely that your update will be reviewed and committed quickly.
 * Avoid changing the spacing, tabs, or quote style on every line in the file. This makes the patch very hard to review, because the real changes are hidden. This will slow down acceptance of your change.
 * Avoid BOMs, they cannot be recognised prior PHP 6.
 * Do not include Wikimedia or Wikipedia-isms in the file, this includes:
 * Not hardcoding "Wikipedia" or its local spelling everywhere. These language files are used for every MediaWiki wiki, including all of our projects at Wikimedia and third-party users. Use for the name and 'Project:' for the link namespace.
 * Do not include calls to non-standard extensions such as and try to remove the problems. You can ask for advice in the IRC channel #mediawiki-i18n in irc.freenode.net.
 * Sort the messages like they are in the English file, add the proper comments and make the file clear (spaces, etc.) using the command  from the command line.

Finally:

Test your update file on a local MediaWiki installation, if at all possible. It's very common for updated files to fail to compile due to basic syntax errors, or to contain less noticeable problems. If they have to be fixed, this takes longer to deal with. If they have to be fixed _after_ the update is installed, that's going to break your wiki for a time (including Wikipedia website). A simple way to check syntax is by using the php syntax checker:

$ php -l LanguageAr.php No syntax errors detected in LanguageAr.php $

Note that this will only catch syntax errors and not runtime errors, you can only test for those by actually running the code.

Remember that the different development branches of MediaWiki are different. The latest development branch may have changes from the current version running on our sites, and you need to take that into account when providing translations.

Create a patch
Before you make a patch make sure that you have not converted UNIX newlines to Windows newlines, doing so will make your patch pretty much useless since every single line will be changed.

It's useless to submit the whole when you have just translated one string. Once you are happy with your changes you will have to make a difference. This is done using the  command. Developers need a unified patch to work with, this is done with:

svn diff

The output will show you the changes, you will want to save that in a file for later submission:

svn diff > patch

Where  is the filename where you want your changes to be saved (DO NOT use the name of a file which already exists or it WILL be overwritten and everything that was in it would be lost).

Note: even if your patch is twice as large as the end result we'd like a patch anyway. It makes it easier to track and apply multiple changes to different versions of the same file.

Submit patch
Patches should be sent to MediaWiki bugzilla (also known as MediaZilla) at http://bugzilla.wikimedia.org/

You will have to create an account on it if you do not have one already. You will need to enter a valid email address

Enter a new bug report for the MediaWiki product.

Enter the version of the original file. If you used the above svn command, you will have grabbed the latest svn version.

Then choose the component which is Internationalization.

You can skip the Platform and OS. Priority should be Normal and Severity should be Enhancement, developers will take care of it later.

Enter a summary, for example: Update for Serbian language (sr)

Describe a bit what you changed, any problem you might have encountered.

Set the "Keywords" field to "patch".

Submit the bug report.

Then you open it again and post the patch file as file attachments to the bug report. DO NOT reference a wiki page which may be further altered after you have tested it.

Monitor bug report
Once submitted, your request is in the queue and a developer will hopefully have a look at it soon. You will receive an email each time an action is taken. If after some days nothing happened, you might want to contact a developer.

You might receive a request from a developer asking to fix some stuff, if everything is fine the patch will be added to MediaWiki repository and the bug marked as fixed. Congratulations, you enhanced the software :)

Subscribe to i18n mailinglist
You can subscribe i18n list to get notifications of changes and other localisation related topics: http://lists.wikimedia.org/mailman/listinfo/mediawiki-i18n

License

 * VERY IMPORTANT NOTE : Any edits made to the language must be licensed under the terms of the GNU General Public License to be included in the MediaWiki software. That is not the same as the GNU Free Documentation License that the general contents of WikiMedia projects are licensed under.

Text editors with unicode support

 * AcroEdit| (win32)
 * BabelPad| (win32; free; especially recommended for right-to-left languages)
 * BBEdit (MacOS X)
 * Bluefish
 * Crimson Editor (win32)
 * Eclipse (OpenSource)
 * EditPlus (win32)
 * Emacs
 * gedit
 * jEdit
 * Kate
 * MadEdit (Linux,Win32)
 * Notepad++ (win32)
 * Notepad2 (win32)
 * NotepadEx (win32)
 * Programmer's Notepad (win32)
 * PSPad Editor (win32)(31 languages)
 * SciTE
 * Smultron (MacOS X)(OpenSource)
 * Taco HTML Edit (MacOS X)
 * TextMate (MacOS X)
 * TextPad (win32)
 * TextWrangler2 (MacOS X)
 * Ultraedit (win32)
 * Vim
 * Yudit|