- Get link
- X
- Other Apps
b:message
The b:message tag, or the message tag, is a tag for rendering a translated message.
Attributes
name - Name of the message to render.
While the output of a b:message tag can usually be achieved with an equivalent data tag, as demonstrated below, the b:message tag also supports parameterized messages (messages which have one or more variables in their content).
Messages which are translated are available in the global messages dictionary.
b:param
b:message tags are combined with nested, self-closing b:param tags to specify the values of parameters when needed.
Example usage
The following 2 tags would produce the same output, since the message postAComment has no parameters.
<b:message name='messages.postAComment' />
<data:messages.postAComment />
For an English blog, this produces 'Post a comment', while for a French blog, it produces 'Enregistrer un commentaire'
Parameterized messages
<b:message name='messages.numberOfComments'>
<b:param name='numComments' expr:value='data:post.numberOfComments' />
</b:message>
On a French blog, for a post with 2 comments, this would produce '2 commentaires', while on an English blog it would produce '2 comments'.