Custom Label : These are custom text value that can be accessed from Apex classes or Visualforce pages. These values can be translated into any language Salesforce supports. Custom labels enable developers to create multilingual applications by automatically presenting information (for example, help text or error messages) in a user’s native language. You can create up to 5,000 custom labels for your organization, and they can be up to 1,000 characters in length.

Access custom labels

  • Go To Setup — Create — Custom Labels
  • Click on New Custom Labels.
  • Enter value for name, value and description

translate-custom-label-values-salesforce

  1. We can use custom label name to access custom label value in visualforce page using $Label global variable.
  2. After creating custom label we can use following code to use custom label in visualforce page
    <apex:page >
       <apex:form >
         <apex:pageblock >
           <apex:outputText value="Value stored in Demo custom label is: "/>
           <apex:outputText value="{!$Label.Demo_Label}" />
         </apex:pageblock>
       </apex:form>
    </apex:page>

Enable the Translation Workbench

The Translation Workbench lets you specify languages you want to translate, assign translators to languages, create translations for customizations you’ve made to your Salesforce organization, and override labels and translations from managed packages. Everything from custom picklist values to custom fields can be translated so your global users can use all of Salesforce in their language.

  1. Go to Setup, enter Translations Settings,select Translations Settings .
  2. Click Enable.( The “Manage Translation” permission is enabled by default in the System Administrator profile. )
  3. Click Add, to add English and any other language(s) that you will be using.
  4. For each language that you intend to customize or translate:
    • Mark the language as Active.
    • Specify one or more translators who have a permission to enter the translations.
    • Save it.

    translate-custom-label-values-salesforce

  5. Repeat the process for all the labels you want to translate.

Translate Custom Label values

  1. First setup your Custom Label and Add translation for it.
    translate-custom-label-values-salesforce
  2. Fill Translation Information
    translate-custom-label-values-salesforce
  3. Now, Based on “language” attribute of <apex:page> we can define the whole page language. we can bind any othe variable also there instead of “en_US” and “fr-ch”.
  4. <apex:page language="fr-ch">
        {!$Label.demo_label}
    </apex:page>

SUPPORT

Leave A Reply

Please verify that you are not a robot.

Tell us about Your Company

How can we help you with your business?




    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home