Using a standard wfMessage(...)->escaped() in the context of a parser function or tag hook is wrong, because it'll use the current user's language, get cached. In reviewing MediaWiki extensions, I've seen a lot of them do this wrong.
The proper invocation should be: wfMessage(...)->inLanguage( $parser->getFunctionLang() )->title( $parser->getTitle() )->escaped();
I don't think people are going to remember to properly do that every time, so we should provide a helper for them (also it took me a while to figure it out as well).
GCI mentors: @Legoktm
For this task you'll need to add a new msg function to the Parser class (file includes/parser/Parser.php in MediaWiki core), and then update any incorrect usages of wfMessage in the CoreTagHooks and CoreParserFunctions classes to use your new method.