Translation

Literal text entered when defining components such as Custom Objects, Fields, and layouts is automatically available to the Salesforce Translation Workbench tool. However, literal text used in the Apex code, Visualforce pages, and Lightning Components needs special attention from the developer through the use of Custom Labels.

It is important to avoid the concatenation of Custom Label values when forming messages to the end user, as it makes it harder for translators to understand the context of the messages and, if needed, resequence the context of the message for other languages. For example, take the The driver XYZ was disqualified message. The following is bad practice:

String message = 
Label.TheDriver + driverName + Label.WasDisqualified;

This is good practice:

String message = String.format(
Label.DriverDisqualified, new String[] { driverName});

The DriverDisqualified Custom Label will be defined as follows:

When creating Custom Labels, be sure to pay attention to the Protected checkbox. If you uncheck it, end users can reference your labels, which you might want to consider if you wish them to reuse your messages, for example, in custom Email Templates or Visualforce pages. However, the downside is that such labels cannot ever (currently) be deleted from your package as your functionality changes.

Finally, remember that, in Visualforce or Lightning, you can utilize the apex:outputField or lightning:outputField components to render the field labels so long as they are contained in apex:pageBlockSection or  lightning:recordView.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.133.147.87