Created
February 16, 2019 05:13
-
-
Save Sunil02kumar/ad1600acd5d1941a45cdd20f78ce62da to your computer and use it in GitHub Desktop.
User Locale Information in Lightning Components
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<aura:application extends="force:slds"> | |
<c:SK_UserLocaleInfoCmp/> | |
</aura:application> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<aura:component> | |
<div style="background-color:#E6E6FA;border-style: solid;margin:5%;padding:2%;"> | |
<b>Getting User Locale Information in Lightning Component Markup</b> | |
<table> | |
<tr> | |
<td>Country</td><td>{!$Locale.country}</td> | |
</tr> | |
<tr> | |
<td>Timezone</td><td>{!$Locale.timezone}</td> | |
</tr> | |
<tr> | |
<td>Currency</td><td>{!$Locale.currency}</td> | |
</tr> | |
<tr> | |
<td>Long Date Format</td><td>{!$Locale.longDateFormat}</td> | |
</tr> | |
</table> | |
</div> | |
<aura:attribute type="String" name="ltngCurrencyCode"/> | |
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/> | |
<div style="background-color:#E6E6FA;border-style: solid;margin:5%;padding:2%;"> | |
<b>Getting User Locale Information from Controller.js</b> | |
<table> | |
<tr> | |
<td>Currency Code</td><td>{!v.ltngCurrencyCode}</td> | |
</tr> | |
</table> | |
</div> | |
</aura:component> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
({ | |
doInit : function(component, event, helper) { | |
var currCode = $A.get("$Locale.currencyCode"); | |
component.set("v.ltngCurrencyCode",currCode); | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment