I'm trying to implement a preview screen with a picklist of available languages and a textbox with translated text. The problem is System.Label.My_Preview_Text or $Label.My_Preview_Text are already translated to current User's locale. Is there a way to retrieve a translation for the specified locale, something like System.Label.getValue('My_Preview_Text','en_US'). Like we can do this in .NET or Java. Is there a way to do that in Apex/VisualForce?

3 Answers 3


You can set the language for your preview apex:page. This documentation says that the language attribute determines:

The language used to display labels that have associated translations in Salesforce. This value overrides the language of the user viewing the page. Possible values for this attribute include any language keys for languages supported by Salesforce, for example, "en" or "en-US".

Based on this unimplemented idea, it looks like there isn't an Apex API where you can specify the language, so in Apex you always get the current User's language.


Unfortunately this is not possible currently in Apex.

This is already posted on IdeaExchange and you can vote on this idea.


Summer '23 added such a feature:

Label.translationExists(namespace, label, language)
Label.get(namespace, label, language)

This is based on this Idea.

  • 1
    This chould be now the accepted answer.
    – Damecek
    Sep 4, 2023 at 11:59

You must log in to answer this question.

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