1 define("dojo/cldr/supplemental", ["../_base/lang", "../i18n"], function(lang, i18n){
4 // dojo/cldr/supplemental
11 lang.setObject("dojo.cldr.supplemental", supplemental);
13 supplemental.getFirstDayOfWeek = function(/*String?*/locale){
15 // Returns a zero-based index for first day of the week
17 // Returns a zero-based index for first day of the week, as used by the local (Gregorian) calendar.
18 // e.g. Sunday (returns 0), or Monday (returns 1)
20 // from http://www.unicode.org/cldr/data/common/supplemental/supplementalData.xml:supplementalData/weekData/firstDay
21 var firstDay = {/*default is 1=Monday*/
23 ae:6,af:6,bh:6,dj:6,dz:6,eg:6,iq:6,ir:6,jo:6,kw:6,
24 ly:6,ma:6,om:6,qa:6,sa:6,sd:6,sy:6,ye:6,
25 ag:0,ar:0,as:0,au:0,br:0,bs:0,bt:0,bw:0,by:0,bz:0,ca:0,cn:0,
26 co:0,dm:0,'do':0,et:0,gt:0,gu:0,hk:0,hn:0,id:0,ie:0,il:0,'in':0,
27 jm:0,jp:0,ke:0,kh:0,kr:0,la:0,mh:0,mm:0,mo:0,mt:0,mx:0,mz:0,
28 ni:0,np:0,nz:0,pa:0,pe:0,ph:0,pk:0,pr:0,py:0,sg:0,sv:0,th:0,
29 tn:0,tt:0,tw:0,um:0,us:0,ve:0,vi:0,ws:0,za:0,zw:0
32 var country = supplemental._region(locale);
33 var dow = firstDay[country];
34 return (dow === undefined) ? 1 : dow; /*Number*/
37 supplemental._region = function(/*String?*/locale){
38 locale = i18n.normalizeLocale(locale);
39 var tags = locale.split('-');
42 // IE often gives language only (#2269)
43 // Arbitrary mappings of language-only locales to a country:
44 region = {de:"de", en:"us", es:"es", fi:"fi", fr:"fr", he:"il", hu:"hu", it:"it",
45 ja:"jp", ko:"kr", nl:"nl", pt:"br", sv:"se", zh:"cn"}[tags[0]];
46 }else if(region.length == 4){
47 // The ISO 3166 country code is usually in the second position, unless a
48 // 4-letter script is given. See http://www.ietf.org/rfc/rfc4646.txt
54 supplemental.getWeekend = function(/*String?*/locale){
56 // Returns a hash containing the start and end days of the weekend
58 // Returns a hash containing the start and end days of the weekend according to local custom using locale,
59 // or by default in the user's locale.
60 // e.g. {start:6, end:0}
62 // from http://www.unicode.org/cldr/data/common/supplemental/supplementalData.xml:supplementalData/weekData/weekend{Start,End}
63 var weekendStart = {/*default is 6=Saturday*/
65 af:4,dz:4,ir:4,om:4,sa:4,ye:4,
66 ae:5,bh:5,eg:5,il:5,iq:5,jo:5,kw:5,ly:5,ma:5,qa:5,sd:5,sy:5,tn:5
69 weekendEnd = {/*default is 0=Sunday*/
70 af:5,dz:5,ir:5,om:5,sa:5,ye:5,
71 ae:6,bh:5,eg:6,il:6,iq:6,jo:6,kw:6,ly:6,ma:6,qa:6,sd:6,sy:6,tn:6
74 country = supplemental._region(locale),
75 start = weekendStart[country],
76 end = weekendEnd[country];
78 if(start === undefined){start=6;}
79 if(end === undefined){end=0;}
80 return {start:start, end:end}; /*Object {start,end}*/