We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to change the culture of the DatePicker control based on the browser language?

You can set the localization for Syncfusion controls like TextBoxes, DatePicker, etc. based on the browser culture by using the locale property. There is an in-built method called the ej.browserInfo () that returns the browser information as an object. Then, pass this culture information to the locale property of the components. Refer to the following code example that demonstrates the same.

 

 

In the code, ej.browserInfo().culture.name is specified as the value for the locale property. Now, DatePicker control culture is set based on the browser culture. You can also set the browser culture to the controls dynamically by using their instance, as given in the following code example.

 

 

To apply a different culture to the components other than the English culture, include the corresponding culture file. So, based on the browser culture, include the corresponding culture file in the application. The globalize.cultures.js is a combined script file for all the cultures, and includes all the culture-related files.

Sample Links:

For globalize.culture.js: http://ajax.aspnetcdn.com/ajax/globalize/0.1.1/cultures/globalize.cultures.js

For online documentation: http://help.syncfusion.com/js/localization

Article ID: Published Date: Last Revised Date: Platform: Control:
4904 05/18/2015 10/09/2015 JavaScript ejDatePicker
Tags:
Did you find this information helpful?
Add Comment
You must log in to leave a comment

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon