Page MenuHomePhabricator

MessageValue and Message should share a common interface; MediaWiki\Message\Converter should be unnecessary
Open, Needs TriagePublic

Description

When passing data between older code and newer code, we often have to convert from MessageValue to Message, or the other way around, which is implemented in MediaWiki\Message\Converter.

This is silly. Both of them just represent a message key and parameters. They should share a common interface – we could reuse MessageSpecifier for this – and be able to be constructed from another MessageSpecifier, so we wouldn't need explicit conversion.

(Similarly to how e.g. Title and TitleValue implement LinkTarget, and can be constructed from each other using newFromLinkTarget().)

Ideally the internal formats would also be close enough that we wouldn't need so much code to convert between them.

There's also another benefit to making MessageValue use the MessageSpecifier interface: MessageSpecifier is a read-only view of the data, so this could guarantee that functions that are supposed to print messages can't accidentally modify them.