| Load Data : English | Spanish | French | Arab | Chinese | |
| Effective Locale : |
Crop production index (1999-2010)
(Data from : World Bank)Note: Before you type in some inputs to test, ensure you have set your desired settings in the panel on the left and have clicked "Apply Settings".
Collator Testing :
Sort
Compare
| and | are | - |
Search
(You can paste locale specific content and try your search)
Search keyword :
NumberFormat Testing :
DateTimeFormat Testing :
Test Date: , Hours Mins
Reference documents
A super quick introduction to the APIs
Globalization is the namespace that consists of the following objects.
- LocaleList
You can specify the list of locales in priority order which will be resolved based on the availability. For e.g. if you request en-US and en-GB, if the OS supports en-US, the same will become the active locale or en-GB will be checked. The default is the browser's current locale.
- Collator
Takes the LocaleList object as an argument. You can do either sort or search
- NumberFormat
Takes the LocaleList object as an argument. You can format the number as decimal, currency or percentage
- DateTimeFormat
Takes the LocaleList object as an argument. You can format the dates into various formats (y/d/m or yy/dd/mm etc.) and request for the calendars (gregorian, islamic or buddhist etc.) supported
Sample code
// Construct locale list which is the first step
var ll = new Intl.LocaleList(["en-US", "en-GB", "en-IN"]);
// Construct collator object and do some sorting
var co = new Intl.Collator(ll);
var arr = ["z", "b", "a"];
arr.sort( function(a,b){
return co.compare(a,b)
});
// Construct NumberFormat object and format a number
var nf = new Intl.NumberFormat(ll, {style: "percent"});
nf.format(100.11); // Prints 100%
// Construct DateTimeFormat object and format a date
var nf = new Intl.DateTimeFormat(ll);
dtf.format();
Report bugs to
- SureshJa@microsoft.com
- JSi18nDisc@microsoft.com