* Andrew Garrett agarrett@wikimedia.org [Mon, 29 Mar 2010 09:21:45 +1100]:
I'm definitely a fan of trying to make our message system better and more consistent.
However, I'm not really convinced by this proposal. A few points:
- I don't like that the trivial case is Message::key() – you can't
beat the brevity of a global function, and I'd like to see something short and to the point.
- I don't like the idea of passing parameters through a call chain –
it's just not how things are really done in PHP, and it leads to all sorts of bizarre behaviour (like the bug mentioned above). It's not really in conformance with standard MediaWiki syntax. I don't see that it confers any advantages over named parameters.
I personally like how Linker::Link() uses arrays as parameters, instead of bunch of early outdated methods. Flexible and quite powerful. Also, it's nice when tags and attributes are rendered and properly closed by output method itself, so instead of Message::key( 'bad-message' )->rawParams( '<script>...</script>' )->escaped(); tagname 'script' would be a call parameter.
Tags autonesting (autoclosing) is especially nice for tables and lists.
I'd prefer to see a Message class (instantiated with a shorthand global function like wfMessage()) which represented an original message. Then, methods like withParameters() or withRawParameters() would create a MessageInstance class, which is like a Message class but with some parameters included. You could include the language in either the Message constructor, or you could set it with a method, perhaps setLanguage(). You could then call $msg->html(), $msg->escapedHtml(), $msg->wikitext(), $msg->escapedWikitext() or $msg->text() on EITHER the Message or MessageInstance class to get the appropriate output.
This is just off the top of my head, does anybody have any thoughts?
Calls has to be short so the code won't grew too much. Dmitriy