Category Archives: vapaasuomi

Goes to vapaasuomi planet

Putting that another pair of eyes into good use

This blog post is about the MediaWiki Translate extension and explains how we got to develop a new set of translation review tools.

One of the core principles at translatewiki.net is that the time of translators is a prestige resource. We show our appreciation to translators by providing tools that let them concentrate 100% on the task at hand and let the (volunteer) staff handle the boring tasks.

It is well known that good translators take pride of their and others work. This may result in a urge to review all translations made by other translators. I consider myself being that kind of translator. The good news is that in recent months the Translate extension has got massively better at supporting reviewing of translations. Some weeks ago we added a new listing where you can click a button to accept a translation. When the list is empty, you know that all translations have either been made or fixed by you, or you have accepted someone elses’ translations.

This is all nice and dandy, but if you want to review new translations as they come in it is not practical. You’d either have to watch the list of recent translations or subscribe to the feed of them. From here you can get to the individual messages, but it takes many clicks to get to the page where you see the button to accept the translation. And iterating over each of the hundreds of message groups to see if there is anything to accept is not practical either.

The solution: a special message group which lists the recent translations in a given language. Since only some of the translators are allowed to review, on the right you can see a screenshot of how it looks like – click to enlarge. One could bookmark this page and have a look at it a few times per week. For me this is a real time saver, and I’m sure others will find it useful too.

To get this implemented, I originally anticipated that some heavy refactoring was needed and I estimated about one and a half day for it. In the end it took only about half a day – I was positively surprised how painless the refactoring was. The problem was that the class which fetches all the messages from the database assumed they all belong in the same MediaWiki namespace. In translatewiki.net we have over ten namespaces for translations of different projects, so it had to be fixed. I’d say this is a prime example of the saying Premature optimization is the root of all evil by Donald Knuth.

In the future we need to link this page from suitable places to make this feature discoverable and also to make sure that more than the current 66 users out of 3000+ translators get the right to use this feature.

MediaWiki grows up – no more playing with Lego

User interface messages built from pieces of text or leaving some parts out of a message are what is called Lego messages. The end result of this practice is not a glittering Lego castle. The end result is more like a shady shack with a leaking roof.

Major Lego message usage in MediaWiki will soon be in the past as I have refactored the MediaWiki logging system and brought the code to match with what we expect from internationalisation today. Instead of snippets “moved X to Y” translators can now work with full sentences like “U moved X to Y”. It makes it possible to change the message to “Page X was moved to Y by U”. Consider the languages where sentences don’t begin with the subject. It must have been as awkward as “moved U X to Y” would be in English.

There is more: translations can now take the gender of the user who performed the action into account. English almost always gets away from taking sides in interface messages, but that is not the case in many other languages.

We already have many translations using these new possibilities:

  • English: Nike moved page Hapsen to Saalen
  • Welsh: Symudwyd y dudalen Hapsen i Saalen gan Nike
  • Russian (male): Nike переименовал страницу Hapsen в Saalen
  • Russian (female): Никa переименовала страницу Hapsen в Saalen

WebWorld 2011 – wrap-up

Unfortunately my time machine is broken, so instead of telling what cool features are coming you have to bear with summary of what I did during the WebWorld sprint.

As you know UserBase Wiki uses the Translate extension to translate the wiki content. I can now cross off a common feature request from my todo list: moving and deleting translated pages. Since each language has its own page and the system uses even more pages behind the scenes, the normal move and delete actions of MediaWiki were insufficient. With some hackish code I was able to hijack those actions and replace them with my own. It is now possible to move or delete a page with all of its translations with few clicks. You can also choose to delete only one translation, which is useful if the translator accidentally used a wrong language.

For those who are addicted to stats, Special:LanguageStats now has a row which states the overall translation coverage. The number can be off a small amount for a reason unknown to me. I have to investigate why and fixit, since statistics never lie :)

And there is one more nicety regarding Special:MyLanguage, which takes care of redirecting users to their preferred language translation of a page, assuming such a translation exists. If the given page does not exist at all, the link using Special:MyLanguage is now red just like normal links to non-existing pages are.

The sprint itself was  productive. There were problems that needed to be solved, and I think we all did a good job tackling the many issues. We also managed to create some new problems: Ingo needs to learn how to not have toys stuck in inconvenient high places :) And I like the logo very much :)

Webworld 2011 – MediaWiki and UserBase

Greetings to the Planet KDE readers, where this should be my first blog post. My nickname on the net is Nikerabbit. I’ve been developing MediaWiki for many years, and I’m the author of the Translate extension. The Translate extension is used at translatewiki.net which is a wiki site and community that does open source software translation. Translate extension can also be used to translate wikipages, which is the way it is used on userbase.kde.org.

That is also the reason why I am now here at the KDE WebWorld sprint. I have updated the Translate extension on UserBase and fixed a number of bugs in it. Mostly minor things that can confuse normal users – they are no longer automatically directed to pages that are of no use to them. And UserBase now has its own translation memory. It’s the same kind we use in translatewiki.net: a very simple one provided by the translate toolkit. Currently those two are independent of each other, but maybe in the future we can find a way to use each others translations.

While working on UserBase issues here, I realized some problems in MediaWiki. First of all the Translate extension is supposed to be compatible with two MediaWiki versions: the latest stable version (1.16, used on UseBase) and the latest development version (1.19alpha, used on translatewiki.net). I am not going to talk about why there are two unreleased versions and third one being in development. Anyway, a lot of development has happened between those versions, including major new features and big rewrites. I’m spending a considerable time keeping Translate extension compatible with 1.16 when developing new features for it. It also makes the code more complex and doubles the testing required. It is not made easier by the fact that not all changes are documented in appropriate places. For example there is no mentions in hooks.txt that the parameters for SkinSubPageSubtitle hook have been changed at some point.

Another thing is that MediaWiki has so many ways to tweak it, most of them undocumented and not easily discoverable. For example all the messages in MediaWiki: namespace, some of which may even be empty by default. There is no way you can find a suitable message unless you already know that such message exists and how it is called. The same applies to configuration variables. They are at least documented in DefaultSettings.php and some also in mediawiki.org, but again it is hard to find some specific thing that could help you (if it even occurs to you that such thing might exist).

This means that people can’t really find out everything you can do with MediaWiki and they either end up not doing some things at all or creating something new from scratch.