On 08.07.2010, 13:02 Niklas wrote:
i18n( 'welcometo' $wgSitename)->text();
or if we don't have a wrapper, use this whatever the class name might be:
Message::key( 'welcometo', $wgSitename )->text();
I don't like the function name 'key', it's unclear. Message::get()
would be better imho.
Other suggestions in the past have been:
_ (Used by Gettext, objected because it's not clear what it does)
_m (no comments)
Message is fine. At most, we could rename it to Msg for those who are
too lazy to type.
I really don't believe that chaining method calls
is too hard to use
(or easy to misuse) for any of our developers. I recently noticed that
FreeCol game (written in Java) uses chaining for message system very
similar to this.
Yes, it is possible to use it in the wrong way, but I
doubt that
anyone is going to do that by accident, given the good documentation
and plenty of correct examples. The few exception if any will be
noticed easily in code review and fixed.
Chaining could be surprizingly clear, albeit verbose. Much better
anyway than the insanity we currently use:
* wfMsg - mostly clear what it does
* wfMsgNoTrans - ehm...
* wfMsgForContent - what, what else do we use 'em for? Interface?
Okay, I'll use wfMsgForInterface next time.
* wfMsgForContentNoTrans - ouch, my eyes!
* wfMsgNoDB
* wfMsgNoDBForContent
* wfMsgReal
* wfMsgWeirdKey - omg
* wfMsgHtml - probably clear what it does, but one'll have to guess
some details
* wfMsgWikiHtml - absolutely unclear
* wfMsgExt - grrrrr
--
Best regards,
Max Semenik ([[User:MaxSem]])