master
1/*
2 *
3 * Date.addLocale(<code>) adds this locale to Sugar.
4 * To set the locale globally, simply call:
5 *
6 * Date.setLocale('nl');
7 *
8 * var locale = Date.getLocale(<code>) will return this object, which
9 * can be tweaked to change the behavior of parsing/formatting in the locales.
10 *
11 * locale.addFormat adds a date format (see this file for examples).
12 * Special tokens in the date format will be parsed out into regex tokens:
13 *
14 * {0} is a reference to an entry in locale.tokens. Output: (?:the)?
15 * {unit} is a reference to all units. Output: (day|week|month|...)
16 * {unit3} is a reference to a specific unit. Output: (hour)
17 * {unit3-5} is a reference to a subset of the units array. Output: (hour|day|week)
18 * {unit?} "?" makes that token optional. Output: (day|week|month)?
19 *
20 * {day} Any reference to tokens in the modifiers array will include all with the same name. Output: (yesterday|today|tomorrow)
21 *
22 * All spaces are optional and will be converted to "\s*"
23 *
24 * Locale arrays months, weekdays, units, numbers, as well as the "src" field for
25 * all entries in the modifiers array follow a special format indicated by a colon:
26 *
27 * minute:|s = minute|minutes
28 * thicke:n|r = thicken|thicker
29 *
30 * Additionally in the months, weekdays, units, and numbers array these will be added at indexes that are multiples
31 * of the relevant number for retrieval. For example having "sunday:|s" in the units array will result in:
32 *
33 * units: ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sundays']
34 *
35 * When matched, the index will be found using:
36 *
37 * units.indexOf(match) % 7;
38 *
39 * Resulting in the correct index with any number of alternates for that entry.
40 *
41 */
42
43Date.addLocale('nl', {
44 'plural': true,
45 'months': 'januari,februari,maart,april,mei,juni,juli,augustus,september,oktober,november,december',
46 'weekdays': 'zondag|zo,maandag|ma,dinsdag|di,woensdag|woe|wo,donderdag|do,vrijdag|vrij|vr,zaterdag|za',
47 'units': 'milliseconde:|n,seconde:|n,minu:ut|ten,uur,dag:|en,we:ek|ken,maand:|en,jaar',
48 'numbers': 'een,twee,drie,vier,vijf,zes,zeven,acht,negen',
49 'tokens': '',
50 'short':'{d} {Month} {yyyy}',
51 'long': '{d} {Month} {yyyy} {H}:{mm}',
52 'full': '{Weekday} {d} {Month} {yyyy} {H}:{mm}:{ss}',
53 'past': '{num} {unit} {sign}',
54 'future': '{num} {unit} {sign}',
55 'duration': '{num} {unit}',
56 'timeMarker': "'s|om",
57 'modifiers': [
58 { 'name': 'day', 'src': 'gisteren', 'value': -1 },
59 { 'name': 'day', 'src': 'vandaag', 'value': 0 },
60 { 'name': 'day', 'src': 'morgen', 'value': 1 },
61 { 'name': 'day', 'src': 'overmorgen', 'value': 2 },
62 { 'name': 'sign', 'src': 'geleden', 'value': -1 },
63 { 'name': 'sign', 'src': 'vanaf nu', 'value': 1 },
64 { 'name': 'shift', 'src': 'laatste|vorige|afgelopen', 'value': -1 },
65 { 'name': 'shift', 'src': 'volgend:|e', 'value': 1 }
66 ],
67 'dateParse': [
68 '{num} {unit} {sign}',
69 '{0?} {unit=5-7} {shift}',
70 '{0?} {shift} {unit=5-7}'
71 ],
72 'timeParse': [
73 '{weekday?} {date?} {month} {year?}',
74 '{shift} {weekday}'
75 ]
76});