", "upvoteCount": 0, "url": "https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000A7YkFSAV", "datePublished": "2014-01-28T01:58:25.000Z", "author": { "@type": "Person", "name": "Vamsi Gosu", "url": "https://trailblazers.salesforce.com/profileView?u=00530000009YMcJAAW", "affiliation": { "@type": "Organization", "name": "TechForce Services" } } } ] } } Skip to main content
 I need to get the value of Locale from user object using javascript.

 

Could you please help me on this?

 

 locale value from user object

 

Regards,

 

Paddy
3 answers
  1. Jan 28, 2014, 1:58 AM
    Paddy,

     

    once you get the locale in your apex controller and assign it to a variable, you can access the same in your javascript.. it will be available on page load..

     

    Apex Controller

     

    Public String UserLocale {get; set;}

     

    public void MyController(){

     

     UserLocale = UserInfo.getLocale();

     

    }

     

    Javascript in your visualforce page

     

    <script>

     

    var userLocale='{!userLocale}';

     

    if(userLocale == 'en-US'){

     

    //do your logic

     

    }

     

    </script>