Open Bug 1564986 Opened 5 months ago Updated 4 months ago

Replace _formatDescriptionMessage with something better


(Toolkit :: Notifications and Alerts, enhancement)

Not set




(Reporter: ehsan, Unassigned)


This is a follow-up to bug 1558503. The goal here is to reduce the tax that _formatDescriptionMessage introduces on localizers. I'm not 100% sure if I understand all of the details of what's being requested there (I'm filing this at the request of :flod) so I'll repeat a comment here verbatim.

(In reply to Francesco Lodolo [:flod] from comment #18)

(In reply to :Ehsan Akhgari from comment #17)

I'd be happy to, but I'm not sure what you're suggesting specifically to do. Can you please be more explicit about it (since I can see a few possibilities here). Thanks!

Remove code that relies on intermediate interpolations of the strings, and use the strings directly.

There's only one possible defined format supported for properties placeholders (%S or %n$S), turns out we have code that replaces these placeables, to then replace them a second time to inject HTML markup. The code should just should inject this markup in the original string.

I don't see how the current approach can scale. If we ever need a third placeable, we'll need another combination of characters to support it.

To clarify, there's no burden on localizers. The strings remains the same, before and after.

What's unclear is that these strings are manipulated in an opaque way, and that leads to bugs like bug 1558503 (nobody from localization was aware of it).

Also, read the last comment after replying here. I wasn't aware of this, so maybe I'm just asking something that's impossible, and we should just way to move this to Fluent.

Perhaps we can generate HTML markup here instead of this arcane way of injecting strings into HTML, by having an HTML container element inside the <xul:description> element that could accept a fragment, or something like that...

Isn't the solution to this just to use fluent which can have simple inline markup?

You need to log in before you can comment on or make changes to this bug.