-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Theoretically speaking, these two classes have very distinct roles. MessageCache is a cache of messages, where userland code should run off to get messages from. Language, while containing messages, defers this responsibility to MessageCache, and instead lets users call language-specific behavior like formatting dates. So, in theory, while MessageCache is dependent on Language, Language should not be dependent on MessageCache.
In reality, however, this is not the case. Certain functions in the Language objects will occasionally need to call getMessageFromDB (which calls the wfMsg* functions which call the MessageCache) to grab a possibly customized message. The whole thing is terribly convoluted and I'm not sure I understand.
I'm wondering, however, how this would be restructured if you had to chance to refactor this triumvirate of files without any regard to backwards-compatibility. Some questions:
* A global function is currently being used to do parameter substitution: if you were to stuff this in a class, which class would go into? * The message cache is currently used by extension authors to add their own customizable messages to the mix. Is adding the messages straight to the cache the right thing to do, even if it is labeled mExtensionMessages? Would the cache be responsible for message retrieval? Should the class be renamed for sake of truthfulness? * The cache is language aware in that it can accept messages for specific languages but then figure out which one to use once based on $wgContLang or $wgLang (whichever is currently taking precedence).
It appears that MessageCache is not so much a cache but a loose confederation of tools for *getting* messages, performing some magic along with the global functions to figure out where to look, its own cache being only one of many places to look. Which is why I'm having trouble figuring this stuff out.