I have a series of custom labels on a Visualforce page. Not all of the custom labels are required for all languages.

I need to be able to set the custom label to something that will not display anything visible to the user if their language does not require anything to be displayed.

As the text of the label is required, I can't leave it blank. I've also tried just entering whitespace, but that fails validation too. I've tried setting it to  , but that markup is escaped when rendered.

Is there a way to do this without using a magic string and then deciding to render the label based on whether or not the label's text matches the magic string?

2 Answers 2


I managed to do this in Windows using " " (Alt+255); it appears as just a space of the non-breaking variety. You may need to consult your OS's manual to figure out how to type this character in your OS, or you can copy and paste the space from this post.

  • This does appear to be working, but has the downside of admins needing to know this 'trick'. Best answer so far however. Commented Jan 13, 2017 at 20:29
  • 1
    @ChrisPayne Yeah, thinking about it, it'd be nice if they just gave us the ability to make the value optional for a given translation.
    – sfdcfox
    Commented Jan 14, 2017 at 5:11
  • 2
    Lol. OS Manual = google
    – Eric
    Commented Jan 14, 2017 at 15:58
  • That key combo doesn't seem to work if you don't have a full keyboard (e.g. a laptop keyboard). You would need to open character map and manually copy the space character and paste it into the custom label. That worked for me.
    – Pedram
    Commented Sep 26, 2017 at 18:15
  • @Pedram Depends on the keyboard. Some laptops have a Fn+NumLock button you can use, others, like mine, have a full number pad that works, and yes, in some rare systems, you'll need an external keyboard or copy-paste from character map or this answer. I personally tend to use FileFormat.info to find obscure characters to copy-paste. There's a variety of ways you can find a way.
    – sfdcfox
    Commented Sep 26, 2017 at 18:17

You can try out this approach:

Let's say you are assigning &nbsp to the label value.

Whether label to be displayed or not you can make a check and conditionally display that.

<apex:variable value="{!$Label.TestCustomLable}" var="myVar" />
<apex:outputLabel value="{!$Label.TestCustomLable}" rendered="{!myVar!= '&nbsp'}"/>
  • 1
    That will work but the OP specifically requested to avoid this strategy.
    – Adrian Larson
    Commented Jan 13, 2017 at 19:04
  • for my sake of understanding, can you please give some light why to avoid this stratery Commented Jan 13, 2017 at 20:12
  • 1
    It's too fragile, has the potential to cause undesired functionality (ie what if an admin actually wants to display &nbsp?), requires extra markup in the VF page, and just feels like a hack. Commented Jan 13, 2017 at 20:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .