Hello Everyone, In this tutorial, we will know about $Locale global variable in Salesforce Lightning component. $Locale global value provider returns information about the current user's preferred locale. In this unit, I will provide a working example that shows you, how $Locale global value provider works in Salesforce Lightning Component.
After completing this tutorial, you’ll able to:
- How to use $Locale value provider in Lightning Component.
Let's get started
How to use $Locale value provider in Lightning Component?
In Lightning Component -
How to use $Locale value provider in Lightning Component?
In Lightning Component -
<aura:component> <span style="font-weight:bold;font-size:20px;margin-top:20px;margin-left:30px;"> <u>$Locale in Lightning Component</u> </span> <div style="font-weight:bold;margin-top:20px;margin-left:30px;"> Language : {!$Locale.language}<br/> Time Zone : {!$Locale.timezone}<br/> Number Format : {!$Locale.numberFormat}<br/> Currency Format : {!$Locale.currencyFormat} </div> </aura:component>In client-side controller using $A.get() -
({ gettimezone : function(component, event, helper) { var timezone = $A.get("$Locale.timezone"); alert("You time zone is " + timezone); } })
Output:
See also:
- $Browser in Lightning Component
- Multiselect Picklist in Lightning Component
- Global Search Lightning Component
Conclusion:
Hope you like this tutorial, for any query or suggestions please feel free to comment.
Thank you.
0 Comments
Post a Comment