[SalesForce] Is it possible to make text bold in a custom label

Background

We have a custom application which we need to support in multiple languages. Visualforce is our main UI framework.

For internationalization we will use Custom Labels. One of the possible formats we would like to use is as follows:

"Admin sent file1.pdf to the following recipients:"

Note that Admin and file1.pdf should be bold.

I tried creating a custom label with value:

enter image description here

And the result is kind of "expected":

enter image description here

Question

Is it possible, if at all, to use Custom Labels and format part of its text in bold?

Best Answer

If you're displaying it in Visualforce maybe try something like:

<apex:outputText value="{!label}" escape="false"/>

An alternative would be to create multiple labels for the different parts of the string and then manually bold them yourself.

For instance you'd have labels for the following text:

  • sent
  • to the following recipients:

Then output the text in chucnks:

<apex:outputText value="{!userName}" style="font-weight:bold;"/>
<apex:outputText value="{!label1}"><apex:outputtext value="{!fileName}" style="font-weight:bold;"/>
<apex:outputText value="{!label2}"/>

My concern here would be translation as it would be seen as two seperate... sentences? which could create issues in grammar.

Related Topic