Get User $Locale in Lightning Component
Biswajeet
January 9, 2018 No Comments on Get User $Locale in Lightning Component
The $Locale
global value provider returns information about the current user’s preferred locale.
Use $Locale
in Lightning Component:
<aura:component implements="flexipage:availableForAllPageTypes,force:appHostable"> Language : {!$Locale.language} Timezone : {!$Locale.timezone} Country : {!$Locale.country} Currency : {!$Locale.currency} </aura:component>
Use $Locale
in Lightning JS Controller:
doInit : function(component, event, helper) { var locale = $A.get("$Locale.country"); alert("Your Country " + locale); },