Allow object as second i18n.getMessage() argument #699
Labels
needs-triage: chrome
Chrome needs to assess this issue for the first time
needs-triage: firefox
Firefox needs to assess this issue for the first time
neutral: safari
Not opposed or supportive from Safari
topic: localization
Currently, the second
substitutions
argument ofi18n.getMessage()
can be a single stringifiable value, or an array thereof. These substitutions may be referenced in amessage
or theplaceholders
as$1
,$2
, etc. To improve the translator experience, theplaceholders
object allows for these to be mapped to named placeholders in the message:We could improve the legibility of the code formatting this message by allowing for
substitutions
to be an object, so that the above message could be formulated as:and formatted with
In case there's a concern about mis-identifying a substitution value that's intended to be stringified during formatting as instead an object from which substitution values are to be looked up, handling substitutions like this could be gated behind some flag as introduced in #698 for MF2 support. With that syntax, the above message could be formulated as:
The text was updated successfully, but these errors were encountered: