Thread:User talk:IAlex/$wgMessageCache- addMessages() Replacement/reply

You can try the MessagesPreLoad hook.