Sunday 21 February 2021

Define Localized Component Labels and Attribute Values on Lightning Pages Using Custom Labels

 Hi,

Here we are going to learn how to define Localized Component Labels and Attribute Values on Lightning Pages Using Custom Labels.

With Localization Support in App Builder, when you specify a custom label in the Lightning App Builder, you can use {!$Label.customLabelName} to help define the label’s value.

On a Lightning page, custom Tabs component and other component attribute values aren’t localized when they’re entered as plain text in the Lightning App Builder. 

Eg: If we have an org whose default language is English and our Lightning page has a Tabs component with three custom tabs that we named Cars, Trucks, and Planes, the non-English users in our org see those plain text tab label values as Cars, Trucks, and Planes when they view the page. The tab label values aren’t translated into your users’ languages.

However, configuring custom label values in the Lightning App Builder using the {!$Label.customLabelName} expression lets users see labels in their chosen language, if we create a translation for that label in their language.




The {!$Label.customLabelName} expression works with every custom label we create in Setup using the custom label feature. 

The text we define in the Value field for our custom label appears as the label value when the component renders on a Lightning page. 

And, if we create a translated value for the label, users using that language in our org see the translated value.

The {!$Label.customLabelName} expression isn’t limited to use for component or tab labels. 

we can also use it to provide a translated value for any component attribute of type string or rich text.


Reference:

https://help.salesforce.com/articleView?id=sf.lightning_page_components_use_expressions_for_labels.htm&type=5

https://releasenotes.docs.salesforce.com/en-us/spring21/release-notes/rn_forcecom_lab_expressions_in_comp_labels.htm


No comments:

Post a Comment

How to include a screen flow in a Lightning Web Component

 Hi, Assume  you have a flow called "Quick Contact Creation" and API Name for the same is "Quick_Contact_Creation". To i...