Page MenuHomePhabricator

Decouple BlockErrorFormatter from Message and Language
Open, LowPublic

Description

BlockErrorFormatter currently needs the Language object to create a Message for the blocked error.

Instead of Message, we need to make it return MessageValue - this seems to be simple.
Language is more complex - some of the parameters in the block error message are themselves retrieved from messages, blockedtext-composite-ids for example. I propose to introduce a new param type in message system - MessageValueParam - the idea is that it will be formatted by MessageFormatter when the message using it is formatted, and the plain result will be used as a parameter value. So basically it will be lazy-evaluated - this will allow to decouple BlockErrorFormatter from Language.

Event Timeline

Pchelolo created this task.Jan 11 2021, 7:43 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJan 11 2021, 7:43 PM

Apparently MessageValue can already be a value of the parameter, so this is even more simple.

daniel added a subscriber: daniel.Jan 11 2021, 8:29 PM

Sounds like a good plan!

On a somewhat related note, it would be great to allow LinkTarget (and perhaps PageIdentity) as message parameters. LinkTarget and PageIdentity don't know namespace names (only the namespace index), so they can't be used to construct links directly. Looking up the local namespace name should be done by the code that formats the messages.... I guess I should file that separately though :)

Sounds like a good plan!

On a somewhat related note, it would be great to allow LinkTarget (and perhaps PageIdentity) as message parameters. LinkTarget and PageIdentity don't know namespace names (only the namespace index), so they can't be used to construct links directly. Looking up the local namespace name should be done by the code that formats the messages.... I guess I should file that separately though :)

This is a solid idea, but ofc should be separate. Perhaps after we settle on how the formatters will actually work :)

Pchelolo triaged this task as Low priority.Jan 19 2021, 6:29 PM