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. Image for the cookie policy date

Set locale globally

Hello!

Is there any way to set locale globally for all controls at one place? So I could write something like this:

<script>

ej.LocaleManager.setLocale("ru-RU");

<script>

I've searched but not found any information in documentation or forums, there are only help topics about how to set locale for concrete instance of localizablу controls.
Any help would be appreciated.

1 Reply

ES Ezhil S Syncfusion Team June 26, 2015 12:20 PM UTC

Hi Dmitry,

Thanks for your interest with Syncfusion products.

Currently we haven’t provided in built support to set Locale for all Syncfusion control in application wide. You can achieve this by setting the “locale” property for all the Syncfusion widgets before the control is rendered. Please refer the following code snippet,
<code>
[Script]
[Site.Master]

        <script type="text/javascript">

                var globallocale = "ru-RU";

                var widgetsall = ej.widget.registeredWidgets;

                for (var wd in widgetsall) {

                    //this will set locale property to the `ru-RU` if locale property is available in defaults.

                    if (ej.getObject("proto.defaults.locale", widgetsall[wd]))

                        ej.createObject("locale", globallocale, widgetsall[wd].proto.defaults);

                }
        </script>
</code>
Note: You have to add the above code in Master page or before the control rendering so that the locale will be set for all the controls.

Sample prepared can be downloaded from the link below:
http://www.syncfusion.com/downloads/support/forum/119470/ze/Localization-918737638

Please let us know if you have any other queries.

Regards,
Ezhil S


Loader.
Live Chat Icon For mobile
Up arrow icon