It should be easier to send messages to the underlying mustache template with a predictable message key. This will solve two problems 1) making sure messages are always escaped correctly (not double escaped). 2) Make sure template keys map to mustache keys.
After experiments inside Monobook, CologneBlue, Modern and Vector I recommend we add this functionality to core. This is consistent with how we send messages to ResourceLoader modules.
This idea has been explored here:
https://gerrit.wikimedia.org/r/c/mediawiki/skins/Vector/+/599972/19/includes/SkinVector.php
# Acceptance criteria
[] A messages option is added to the SkinMustache constructor in core.
[] These messages are mapped to template keys inside getTemplateData. For example if `messages = [ 'foo' ]` the value of the message foo will be available to the template by referencing `msg-foo`.
[] Vector is updated to use the new capability inside SkinMustache
# Sample code
```
$msgs = $this->options['messages'] ?? [];
$msgData = [];
foreach ( $msgs as $key ) {
$msgData["msg-" . $key] = $this->msg( $key )->text();
}
```