There are two different concepts involved in localizing Wijmo widgets. First, you can globalize dates and numbers for supported cultures. Second, you can provide custom strings for specific buttons, tooltips, and other text that appears in the user interface for each widget.
The following widgets have dates and numbers that you can localize.
You can localize any of these widgets by setting its culture option to a culture supported in globalize.cultures.js. You can find a copy of this file in your installation folder on a path like this:
...\Wijmo\external\cultures
The CDN hosts all of the individual files, or you can download them from Github.
This quick start section demonstrates how to use globalize to localize dates and numbers in a widget. The method is the same for each widget that displays dates or numbers (see the list above).
Step-by-step Globalize
Basic Page Markup |
Copy Code |
---|---|
<!DOCTYPE HTML> <head> </head> <body> </body> </HTML> |
Basic Page Markup |
Copy Code |
---|---|
<!--jQuery References--> <script src="http://code.jquery.com/jquery-1.11.1.min.js" type="text/javascript"></script> <script src="http://code.jquery.com/ui/1.11.0/jquery-ui.min.js" type="text/javascript"></script> <!--Theme--> <link href="http://cdn.wijmo.com/themes/aristo/jquery-wijmo.css" rel="stylesheet" type="text/css" /> <!--Wijmo Widgets CSS--> <link href="http://cdn.wijmo.com/jquery.wijmo-pro.all.3.20161.89.min.css" rel="stylesheet" type="text/css" /> <!--Wijmo Widgets JavaScript--> <script src="http://cdn.wijmo.com/jquery.wijmo-open.all.3.20161.89.min.js" type="text/javascript"></script> <script src="http://cdn.wijmo.com/jquery.wijmo-pro.all.3.20161.89.min.js" type="text/javascript"></script><!--Culture--> <script src="http://cdn.wijmo.com/external/cultures/globalize.culture.fr-FR.js" type="text/javascript"></script> |
<div id="eventscalendar"></div>The <div> element creates the widget, and its id attribute is set to the name of the widget, which we call in the jQuery script to initialize the widget. This markup adds the widget to your page. (See individual widget topics for the markup to use for the other widgets.)
Default value |
Copy Code |
---|---|
<script type="text/javascript"> $(document).ready(function () { $("#eventscalendar").wijevcal({ culture: "fr-FR" }); }); </script> |
In addition to localizing date and number formats using Globalization, Wijmo allows you to localize or customize all of the strings in the widget's UI. Here is sample code for localizing each of the widgets.