sugar-rails 1.2.5.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +110 -28
- data/lib/generators/sugar/build/build_generator.rb +107 -0
- data/lib/generators/sugar/install/install_generator.rb +2 -2
- data/lib/sugar/rails/version.rb +2 -2
- data/sugar-rails.gemspec +1 -1
- data/vendor/assets/javascripts/precompiled/development/array.js +1212 -0
- data/vendor/assets/javascripts/precompiled/development/core.js +329 -0
- data/vendor/assets/javascripts/precompiled/development/date.js +2179 -0
- data/vendor/assets/javascripts/precompiled/development/date_locales.js +952 -0
- data/vendor/assets/javascripts/precompiled/development/date_ranges.js +183 -0
- data/vendor/assets/javascripts/precompiled/development/es5.js +443 -0
- data/vendor/assets/javascripts/precompiled/development/function.js +222 -0
- data/vendor/assets/javascripts/{sugar-inflections.js → precompiled/development/inflections.js} +51 -162
- data/vendor/assets/javascripts/precompiled/development/language.js +383 -0
- data/vendor/assets/javascripts/precompiled/development/number.js +422 -0
- data/vendor/assets/javascripts/precompiled/development/object.js +348 -0
- data/vendor/assets/javascripts/precompiled/development/regexp.js +92 -0
- data/vendor/assets/javascripts/precompiled/development/string.js +871 -0
- data/vendor/assets/javascripts/precompiled/minified/array.js +16 -0
- data/vendor/assets/javascripts/precompiled/minified/core.js +8 -0
- data/vendor/assets/javascripts/precompiled/minified/date.js +40 -0
- data/vendor/assets/javascripts/precompiled/minified/date_locales.js +38 -0
- data/vendor/assets/javascripts/precompiled/minified/date_ranges.js +3 -0
- data/vendor/assets/javascripts/precompiled/minified/es5.js +7 -0
- data/vendor/assets/javascripts/precompiled/minified/function.js +4 -0
- data/vendor/assets/javascripts/precompiled/minified/inflections.js +11 -0
- data/vendor/assets/javascripts/precompiled/minified/language.js +19 -0
- data/vendor/assets/javascripts/precompiled/minified/number.js +5 -0
- data/vendor/assets/javascripts/precompiled/minified/object.js +6 -0
- data/vendor/assets/javascripts/precompiled/minified/regexp.js +2 -0
- data/vendor/assets/javascripts/precompiled/minified/string.js +12 -0
- data/vendor/assets/javascripts/precompiled/readme.txt +3 -0
- data/vendor/assets/javascripts/sugar-development.js +8054 -0
- data/vendor/assets/javascripts/sugar-full.js +179 -0
- data/vendor/assets/javascripts/sugar.js +111 -6211
- metadata +35 -9
- data/vendor/assets/javascripts/sugar-core.js +0 -4001
- data/vendor/assets/javascripts/sugar-dates-only.js +0 -3121
- data/vendor/assets/javascripts/sugar-dates.js +0 -2210
@@ -0,0 +1,952 @@
|
|
1
|
+
/*
|
2
|
+
*
|
3
|
+
* Date.addLocale(<code>) adds this locale to Sugar.
|
4
|
+
* To set the locale globally, simply call:
|
5
|
+
*
|
6
|
+
* Date.setLocale('de');
|
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.optionals. 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
|
+
|
43
|
+
Date.addLocale('de', {
|
44
|
+
'plural': true,
|
45
|
+
'capitalizeUnit': true,
|
46
|
+
'months': 'Januar,Februar,März|Marz,April,Mai,Juni,Juli,August,September,Oktober,November,Dezember',
|
47
|
+
'weekdays': 'Sonntag,Montag,Dienstag,Mittwoch,Donnerstag,Freitag,Samstag',
|
48
|
+
'units': 'Millisekunde:|n,Sekunde:|n,Minute:|n,Stunde:|n,Tag:|en,Woche:|n,Monat:|en,Jahr:|en',
|
49
|
+
'numbers': 'ein:|e|er|en|em,zwei,drei,vier,fuenf,sechs,sieben,acht,neun,zehn',
|
50
|
+
'optionals': 'der',
|
51
|
+
'short':'{d}. {Month} {yyyy}',
|
52
|
+
'long': '{d}. {Month} {yyyy} {H}:{mm}',
|
53
|
+
'full': '{Weekday} {d}. {Month} {yyyy} {H}:{mm}:{ss}',
|
54
|
+
'past': '{sign} {num} {unit}',
|
55
|
+
'future': '{sign} {num} {unit}',
|
56
|
+
'duration': '{num} {unit}',
|
57
|
+
'timeMarker': 'um',
|
58
|
+
'ampm': 'am,pm',
|
59
|
+
'modifiers': [
|
60
|
+
{ 'name': 'day', 'src': 'vorgestern', 'value': -2 },
|
61
|
+
{ 'name': 'day', 'src': 'gestern', 'value': -1 },
|
62
|
+
{ 'name': 'day', 'src': 'heute', 'value': 0 },
|
63
|
+
{ 'name': 'day', 'src': 'morgen', 'value': 1 },
|
64
|
+
{ 'name': 'day', 'src': 'übermorgen|ubermorgen|uebermorgen', 'value': 2 },
|
65
|
+
{ 'name': 'sign', 'src': 'vor:|her', 'value': -1 },
|
66
|
+
{ 'name': 'sign', 'src': 'in', 'value': 1 },
|
67
|
+
{ 'name': 'shift', 'src': 'letzte:|r|n|s', 'value': -1 },
|
68
|
+
{ 'name': 'shift', 'src': 'nächste:|r|n|s+nachste:|r|n|s+naechste:|r|n|s+kommende:n|r', 'value': 1 }
|
69
|
+
],
|
70
|
+
'dateParse': [
|
71
|
+
'{sign} {num} {unit}',
|
72
|
+
'{num} {unit} {sign}',
|
73
|
+
'{shift} {unit=5-7}'
|
74
|
+
],
|
75
|
+
'timeParse': [
|
76
|
+
'{weekday?} {date?} {month} {year?}',
|
77
|
+
'{shift} {weekday}'
|
78
|
+
]
|
79
|
+
});
|
80
|
+
|
81
|
+
/*
|
82
|
+
*
|
83
|
+
* Date.addLocale(<code>) adds this locale to Sugar.
|
84
|
+
* To set the locale globally, simply call:
|
85
|
+
*
|
86
|
+
* Date.setLocale('es');
|
87
|
+
*
|
88
|
+
* var locale = Date.getLocale(<code>) will return this object, which
|
89
|
+
* can be tweaked to change the behavior of parsing/formatting in the locales.
|
90
|
+
*
|
91
|
+
* locale.addFormat adds a date format (see this file for examples).
|
92
|
+
* Special tokens in the date format will be parsed out into regex tokens:
|
93
|
+
*
|
94
|
+
* {0} is a reference to an entry in locale.optionals. Output: (?:the)?
|
95
|
+
* {unit} is a reference to all units. Output: (day|week|month|...)
|
96
|
+
* {unit3} is a reference to a specific unit. Output: (hour)
|
97
|
+
* {unit3-5} is a reference to a subset of the units array. Output: (hour|day|week)
|
98
|
+
* {unit?} "?" makes that token optional. Output: (day|week|month)?
|
99
|
+
*
|
100
|
+
* {day} Any reference to tokens in the modifiers array will include all with the same name. Output: (yesterday|today|tomorrow)
|
101
|
+
*
|
102
|
+
* All spaces are optional and will be converted to "\s*"
|
103
|
+
*
|
104
|
+
* Locale arrays months, weekdays, units, numbers, as well as the "src" field for
|
105
|
+
* all entries in the modifiers array follow a special format indicated by a colon:
|
106
|
+
*
|
107
|
+
* minute:|s = minute|minutes
|
108
|
+
* thicke:n|r = thicken|thicker
|
109
|
+
*
|
110
|
+
* Additionally in the months, weekdays, units, and numbers array these will be added at indexes that are multiples
|
111
|
+
* of the relevant number for retrieval. For example having "sunday:|s" in the units array will result in:
|
112
|
+
*
|
113
|
+
* units: ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sundays']
|
114
|
+
*
|
115
|
+
* When matched, the index will be found using:
|
116
|
+
*
|
117
|
+
* units.indexOf(match) % 7;
|
118
|
+
*
|
119
|
+
* Resulting in the correct index with any number of alternates for that entry.
|
120
|
+
*
|
121
|
+
*/
|
122
|
+
|
123
|
+
Date.addLocale('es', {
|
124
|
+
'plural': true,
|
125
|
+
'months': 'enero,febrero,marzo,abril,mayo,junio,julio,agosto,septiembre,octubre,noviembre,diciembre',
|
126
|
+
'weekdays': 'domingo,lunes,martes,miércoles|miercoles,jueves,viernes,sábado|sabado',
|
127
|
+
'units': 'milisegundo:|s,segundo:|s,minuto:|s,hora:|s,día|días|dia|dias,semana:|s,mes:|es,año|años|ano|anos',
|
128
|
+
'numbers': 'uno,dos,tres,cuatro,cinco,seis,siete,ocho,nueve,diez',
|
129
|
+
'optionals': 'el,de',
|
130
|
+
'short':'{d} {month} {yyyy}',
|
131
|
+
'long': '{d} {month} {yyyy} {H}:{mm}',
|
132
|
+
'full': '{Weekday} {d} {month} {yyyy} {H}:{mm}:{ss}',
|
133
|
+
'past': '{sign} {num} {unit}',
|
134
|
+
'future': '{num} {unit} {sign}',
|
135
|
+
'duration': '{num} {unit}',
|
136
|
+
'timeMarker': 'a las',
|
137
|
+
'ampm': 'am,pm',
|
138
|
+
'modifiers': [
|
139
|
+
{ 'name': 'day', 'src': 'anteayer', 'value': -2 },
|
140
|
+
{ 'name': 'day', 'src': 'ayer', 'value': -1 },
|
141
|
+
{ 'name': 'day', 'src': 'hoy', 'value': 0 },
|
142
|
+
{ 'name': 'day', 'src': 'mañana|manana', 'value': 1 },
|
143
|
+
{ 'name': 'sign', 'src': 'hace', 'value': -1 },
|
144
|
+
{ 'name': 'sign', 'src': 'de ahora', 'value': 1 },
|
145
|
+
{ 'name': 'shift', 'src': 'pasad:o|a', 'value': -1 },
|
146
|
+
{ 'name': 'shift', 'src': 'próximo|próxima|proximo|proxima', 'value': 1 }
|
147
|
+
],
|
148
|
+
'dateParse': [
|
149
|
+
'{sign} {num} {unit}',
|
150
|
+
'{num} {unit} {sign}',
|
151
|
+
'{0} {unit=5-7} {shift}',
|
152
|
+
'{0} {shift} {unit=5-7}'
|
153
|
+
],
|
154
|
+
'timeParse': [
|
155
|
+
'{shift} {weekday}',
|
156
|
+
'{weekday} {shift}',
|
157
|
+
'{date?} {1} {month} {1} {year?}'
|
158
|
+
]
|
159
|
+
});
|
160
|
+
/*
|
161
|
+
*
|
162
|
+
* Date.addLocale(<code>) adds this locale to Sugar.
|
163
|
+
* To set the locale globally, simply call:
|
164
|
+
*
|
165
|
+
* Date.setLocale('fr');
|
166
|
+
*
|
167
|
+
* var locale = Date.getLocale(<code>) will return this object, which
|
168
|
+
* can be tweaked to change the behavior of parsing/formatting in the locales.
|
169
|
+
*
|
170
|
+
* locale.addFormat adds a date format (see this file for examples).
|
171
|
+
* Special tokens in the date format will be parsed out into regex tokens:
|
172
|
+
*
|
173
|
+
* {0} is a reference to an entry in locale.optionals. Output: (?:the)?
|
174
|
+
* {unit} is a reference to all units. Output: (day|week|month|...)
|
175
|
+
* {unit3} is a reference to a specific unit. Output: (hour)
|
176
|
+
* {unit3-5} is a reference to a subset of the units array. Output: (hour|day|week)
|
177
|
+
* {unit?} "?" makes that token optional. Output: (day|week|month)?
|
178
|
+
*
|
179
|
+
* {day} Any reference to tokens in the modifiers array will include all with the same name. Output: (yesterday|today|tomorrow)
|
180
|
+
*
|
181
|
+
* All spaces are optional and will be converted to "\s*"
|
182
|
+
*
|
183
|
+
* Locale arrays months, weekdays, units, numbers, as well as the "src" field for
|
184
|
+
* all entries in the modifiers array follow a special format indicated by a colon:
|
185
|
+
*
|
186
|
+
* minute:|s = minute|minutes
|
187
|
+
* thicke:n|r = thicken|thicker
|
188
|
+
*
|
189
|
+
* Additionally in the months, weekdays, units, and numbers array these will be added at indexes that are multiples
|
190
|
+
* of the relevant number for retrieval. For example having "sunday:|s" in the units array will result in:
|
191
|
+
*
|
192
|
+
* units: ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sundays']
|
193
|
+
*
|
194
|
+
* When matched, the index will be found using:
|
195
|
+
*
|
196
|
+
* units.indexOf(match) % 7;
|
197
|
+
*
|
198
|
+
* Resulting in the correct index with any number of alternates for that entry.
|
199
|
+
*
|
200
|
+
*/
|
201
|
+
|
202
|
+
Date.addLocale('fr', {
|
203
|
+
'plural': true,
|
204
|
+
'months': 'janvier,février|fevrier,mars,avril,mai,juin,juillet,août,septembre,octobre,novembre,décembre|decembre',
|
205
|
+
'weekdays': 'dimanche,lundi,mardi,mercredi,jeudi,vendredi,samedi',
|
206
|
+
'units': 'milliseconde:|s,seconde:|s,minute:|s,heure:|s,jour:|s,semaine:|s,mois,an:|s|née|nee',
|
207
|
+
'numbers': 'un:|e,deux,trois,quatre,cinq,six,sept,huit,neuf,dix',
|
208
|
+
'optionals': ["l'|la|le"],
|
209
|
+
'short':'{d} {month} {yyyy}',
|
210
|
+
'long': '{d} {month} {yyyy} {H}:{mm}',
|
211
|
+
'full': '{Weekday} {d} {month} {yyyy} {H}:{mm}:{ss}',
|
212
|
+
'past': '{sign} {num} {unit}',
|
213
|
+
'future': '{sign} {num} {unit}',
|
214
|
+
'duration': '{num} {unit}',
|
215
|
+
'timeMarker': 'à',
|
216
|
+
'ampm': 'am,pm',
|
217
|
+
'modifiers': [
|
218
|
+
{ 'name': 'day', 'src': 'hier', 'value': -1 },
|
219
|
+
{ 'name': 'day', 'src': "aujourd'hui", 'value': 0 },
|
220
|
+
{ 'name': 'day', 'src': 'demain', 'value': 1 },
|
221
|
+
{ 'name': 'sign', 'src': 'il y a', 'value': -1 },
|
222
|
+
{ 'name': 'sign', 'src': "dans|d'ici", 'value': 1 },
|
223
|
+
{ 'name': 'shift', 'src': 'derni:èr|er|ère|ere', 'value': -1 },
|
224
|
+
{ 'name': 'shift', 'src': 'prochain:|e', 'value': 1 }
|
225
|
+
],
|
226
|
+
'dateParse': [
|
227
|
+
'{sign} {num} {unit}',
|
228
|
+
'{sign} {num} {unit}',
|
229
|
+
'{0} {unit=5-7} {shift}'
|
230
|
+
],
|
231
|
+
'timeParse': [
|
232
|
+
'{0} {date?} {month} {year?}',
|
233
|
+
'{0} {weekday} {shift}'
|
234
|
+
]
|
235
|
+
});
|
236
|
+
|
237
|
+
/*
|
238
|
+
*
|
239
|
+
* Date.addLocale(<code>) adds this locale to Sugar.
|
240
|
+
* To set the locale globally, simply call:
|
241
|
+
*
|
242
|
+
* Date.setLocale('it');
|
243
|
+
*
|
244
|
+
* var locale = Date.getLocale(<code>) will return this object, which
|
245
|
+
* can be tweaked to change the behavior of parsing/formatting in the locales.
|
246
|
+
*
|
247
|
+
* locale.addFormat adds a date format (see this file for examples).
|
248
|
+
* Special tokens in the date format will be parsed out into regex tokens:
|
249
|
+
*
|
250
|
+
* {0} is a reference to an entry in locale.optionals. Output: (?:the)?
|
251
|
+
* {unit} is a reference to all units. Output: (day|week|month|...)
|
252
|
+
* {unit3} is a reference to a specific unit. Output: (hour)
|
253
|
+
* {unit3-5} is a reference to a subset of the units array. Output: (hour|day|week)
|
254
|
+
* {unit?} "?" makes that token optional. Output: (day|week|month)?
|
255
|
+
*
|
256
|
+
* {day} Any reference to tokens in the modifiers array will include all with the same name. Output: (yesterday|today|tomorrow)
|
257
|
+
*
|
258
|
+
* All spaces are optional and will be converted to "\s*"
|
259
|
+
*
|
260
|
+
* Locale arrays months, weekdays, units, numbers, as well as the "src" field for
|
261
|
+
* all entries in the modifiers array follow a special format indicated by a colon:
|
262
|
+
*
|
263
|
+
* minute:|s = minute|minutes
|
264
|
+
* thicke:n|r = thicken|thicker
|
265
|
+
*
|
266
|
+
* Additionally in the months, weekdays, units, and numbers array these will be added at indexes that are multiples
|
267
|
+
* of the relevant number for retrieval. For example having "sunday:|s" in the units array will result in:
|
268
|
+
*
|
269
|
+
* units: ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sundays']
|
270
|
+
*
|
271
|
+
* When matched, the index will be found using:
|
272
|
+
*
|
273
|
+
* units.indexOf(match) % 7;
|
274
|
+
*
|
275
|
+
* Resulting in the correct index with any number of alternates for that entry.
|
276
|
+
*
|
277
|
+
*/
|
278
|
+
|
279
|
+
Date.addLocale('it', {
|
280
|
+
'plural': true,
|
281
|
+
'months': 'Gennaio,Febbraio,Marzo,Aprile,Maggio,Giugno,Luglio,Agosto,Settembre,Ottobre,Novembre,Dicembre',
|
282
|
+
'weekdays': 'Domenica,Luned:ì|i,Marted:ì|i,Mercoled:ì|i,Gioved:ì|i,Venerd:ì|i,Sabato',
|
283
|
+
'units': 'millisecond:o|i,second:o|i,minut:o|i,or:a|e,giorn:o|i,settiman:a|e,mes:e|i,ann:o|i',
|
284
|
+
'numbers': "un:|a|o|',due,tre,quattro,cinque,sei,sette,otto,nove,dieci",
|
285
|
+
'optionals': "l'|la|il",
|
286
|
+
'short':'{d} {Month} {yyyy}',
|
287
|
+
'long': '{d} {Month} {yyyy} {H}:{mm}',
|
288
|
+
'full': '{Weekday} {d} {Month} {yyyy} {H}:{mm}:{ss}',
|
289
|
+
'past': '{num} {unit} {sign}',
|
290
|
+
'future': '{num} {unit} {sign}',
|
291
|
+
'duration': '{num} {unit}',
|
292
|
+
'timeMarker': 'alle',
|
293
|
+
'ampm': 'am,pm',
|
294
|
+
'modifiers': [
|
295
|
+
{ 'name': 'day', 'src': 'ieri', 'value': -1 },
|
296
|
+
{ 'name': 'day', 'src': 'oggi', 'value': 0 },
|
297
|
+
{ 'name': 'day', 'src': 'domani', 'value': 1 },
|
298
|
+
{ 'name': 'day', 'src': 'dopodomani', 'value': 2 },
|
299
|
+
{ 'name': 'sign', 'src': 'fa', 'value': -1 },
|
300
|
+
{ 'name': 'sign', 'src': 'da adesso', 'value': 1 },
|
301
|
+
{ 'name': 'shift', 'src': 'scors:o|a', 'value': -1 },
|
302
|
+
{ 'name': 'shift', 'src': 'prossim:o|a', 'value': 1 }
|
303
|
+
],
|
304
|
+
'dateParse': [
|
305
|
+
'{num} {unit} {sign}',
|
306
|
+
'{0} {unit=5-7} {shift}',
|
307
|
+
'{0} {shift} {unit=5-7}'
|
308
|
+
],
|
309
|
+
'timeParse': [
|
310
|
+
'{weekday?} {date?} {month} {year?}',
|
311
|
+
'{shift} {weekday}'
|
312
|
+
]
|
313
|
+
});
|
314
|
+
|
315
|
+
/*
|
316
|
+
*
|
317
|
+
* Date.addLocale(<code>) adds this locale to Sugar.
|
318
|
+
* To set the locale globally, simply call:
|
319
|
+
*
|
320
|
+
* Date.setLocale('ja');
|
321
|
+
*
|
322
|
+
* var locale = Date.getLocale(<code>) will return this object, which
|
323
|
+
* can be tweaked to change the behavior of parsing/formatting in the locales.
|
324
|
+
*
|
325
|
+
* locale.addFormat adds a date format (see this file for examples).
|
326
|
+
* Special tokens in the date format will be parsed out into regex tokens:
|
327
|
+
*
|
328
|
+
* {0} is a reference to an entry in locale.optionals. Output: (?:the)?
|
329
|
+
* {unit} is a reference to all units. Output: (day|week|month|...)
|
330
|
+
* {unit3} is a reference to a specific unit. Output: (hour)
|
331
|
+
* {unit3-5} is a reference to a subset of the units array. Output: (hour|day|week)
|
332
|
+
* {unit?} "?" makes that token optional. Output: (day|week|month)?
|
333
|
+
*
|
334
|
+
* {day} Any reference to tokens in the modifiers array will include all with the same name. Output: (yesterday|today|tomorrow)
|
335
|
+
*
|
336
|
+
* All spaces are optional and will be converted to "\s*"
|
337
|
+
*
|
338
|
+
* Locale arrays months, weekdays, units, numbers, as well as the "src" field for
|
339
|
+
* all entries in the modifiers array follow a special format indicated by a colon:
|
340
|
+
*
|
341
|
+
* minute:|s = minute|minutes
|
342
|
+
* thicke:n|r = thicken|thicker
|
343
|
+
*
|
344
|
+
* Additionally in the months, weekdays, units, and numbers array these will be added at indexes that are multiples
|
345
|
+
* of the relevant number for retrieval. For example having "sunday:|s" in the units array will result in:
|
346
|
+
*
|
347
|
+
* units: ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sundays']
|
348
|
+
*
|
349
|
+
* When matched, the index will be found using:
|
350
|
+
*
|
351
|
+
* units.indexOf(match) % 7;
|
352
|
+
*
|
353
|
+
* Resulting in the correct index with any number of alternates for that entry.
|
354
|
+
*
|
355
|
+
*/
|
356
|
+
|
357
|
+
Date.addLocale('ja', {
|
358
|
+
'monthSuffix': '月',
|
359
|
+
'weekdays': '日曜日,月曜日,火曜日,水曜日,木曜日,金曜日,土曜日',
|
360
|
+
'units': 'ミリ秒,秒,分,時間,日,週間|週,ヶ月|ヵ月|月,年',
|
361
|
+
'short': '{yyyy}年{M}月{d}日',
|
362
|
+
'long': '{yyyy}年{M}月{d}日 {H}時{mm}分',
|
363
|
+
'full': '{yyyy}年{M}月{d}日 {Weekday} {H}時{mm}分{ss}秒',
|
364
|
+
'past': '{num}{unit}{sign}',
|
365
|
+
'future': '{num}{unit}{sign}',
|
366
|
+
'duration': '{num}{unit}',
|
367
|
+
'timeSuffixes': '時,分,秒',
|
368
|
+
'ampm': '午前,午後',
|
369
|
+
'modifiers': [
|
370
|
+
{ 'name': 'day', 'src': '一昨日', 'value': -2 },
|
371
|
+
{ 'name': 'day', 'src': '昨日', 'value': -1 },
|
372
|
+
{ 'name': 'day', 'src': '今日', 'value': 0 },
|
373
|
+
{ 'name': 'day', 'src': '明日', 'value': 1 },
|
374
|
+
{ 'name': 'day', 'src': '明後日', 'value': 2 },
|
375
|
+
{ 'name': 'sign', 'src': '前', 'value': -1 },
|
376
|
+
{ 'name': 'sign', 'src': '後', 'value': 1 },
|
377
|
+
{ 'name': 'shift', 'src': '去|先', 'value': -1 },
|
378
|
+
{ 'name': 'shift', 'src': '来', 'value': 1 }
|
379
|
+
],
|
380
|
+
'dateParse': [
|
381
|
+
'{num}{unit}{sign}'
|
382
|
+
],
|
383
|
+
'timeParse': [
|
384
|
+
'{shift}{unit=5-7}{weekday?}',
|
385
|
+
'{year}年{month?}月?{date?}日?',
|
386
|
+
'{month}月{date?}日?',
|
387
|
+
'{date}日'
|
388
|
+
]
|
389
|
+
});
|
390
|
+
|
391
|
+
/*
|
392
|
+
*
|
393
|
+
* Date.addLocale(<code>) adds this locale to Sugar.
|
394
|
+
* To set the locale globally, simply call:
|
395
|
+
*
|
396
|
+
* Date.setLocale('ko');
|
397
|
+
*
|
398
|
+
* var locale = Date.getLocale(<code>) will return this object, which
|
399
|
+
* can be tweaked to change the behavior of parsing/formatting in the locales.
|
400
|
+
*
|
401
|
+
* locale.addFormat adds a date format (see this file for examples).
|
402
|
+
* Special tokens in the date format will be parsed out into regex tokens:
|
403
|
+
*
|
404
|
+
* {0} is a reference to an entry in locale.optionals. Output: (?:the)?
|
405
|
+
* {unit} is a reference to all units. Output: (day|week|month|...)
|
406
|
+
* {unit3} is a reference to a specific unit. Output: (hour)
|
407
|
+
* {unit3-5} is a reference to a subset of the units array. Output: (hour|day|week)
|
408
|
+
* {unit?} "?" makes that token optional. Output: (day|week|month)?
|
409
|
+
*
|
410
|
+
* {day} Any reference to tokens in the modifiers array will include all with the same name. Output: (yesterday|today|tomorrow)
|
411
|
+
*
|
412
|
+
* All spaces are optional and will be converted to "\s*"
|
413
|
+
*
|
414
|
+
* Locale arrays months, weekdays, units, numbers, as well as the "src" field for
|
415
|
+
* all entries in the modifiers array follow a special format indicated by a colon:
|
416
|
+
*
|
417
|
+
* minute:|s = minute|minutes
|
418
|
+
* thicke:n|r = thicken|thicker
|
419
|
+
*
|
420
|
+
* Additionally in the months, weekdays, units, and numbers array these will be added at indexes that are multiples
|
421
|
+
* of the relevant number for retrieval. For example having "sunday:|s" in the units array will result in:
|
422
|
+
*
|
423
|
+
* units: ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sundays']
|
424
|
+
*
|
425
|
+
* When matched, the index will be found using:
|
426
|
+
*
|
427
|
+
* units.indexOf(match) % 7;
|
428
|
+
*
|
429
|
+
* Resulting in the correct index with any number of alternates for that entry.
|
430
|
+
*
|
431
|
+
*/
|
432
|
+
|
433
|
+
Date.addLocale('ko', {
|
434
|
+
'digitDate': true,
|
435
|
+
'monthSuffix': '월',
|
436
|
+
'weekdays': '일요일,월요일,화요일,수요일,목요일,금요일,토요일',
|
437
|
+
'units': '밀리초,초,분,시간,일,주,개월|달,년',
|
438
|
+
'numbers': '일|한,이,삼,사,오,육,칠,팔,구,십',
|
439
|
+
'short': '{yyyy}년{M}월{d}일',
|
440
|
+
'long': '{yyyy}년{M}월{d}일 {H}시{mm}분',
|
441
|
+
'full': '{yyyy}년{M}월{d}일 {Weekday} {H}시{mm}분{ss}초',
|
442
|
+
'past': '{num}{unit} {sign}',
|
443
|
+
'future': '{num}{unit} {sign}',
|
444
|
+
'duration': '{num}{unit}',
|
445
|
+
'timeSuffixes': '시,분,초',
|
446
|
+
'ampm': '오전,오후',
|
447
|
+
'modifiers': [
|
448
|
+
{ 'name': 'day', 'src': '그저께', 'value': -2 },
|
449
|
+
{ 'name': 'day', 'src': '어제', 'value': -1 },
|
450
|
+
{ 'name': 'day', 'src': '오늘', 'value': 0 },
|
451
|
+
{ 'name': 'day', 'src': '내일', 'value': 1 },
|
452
|
+
{ 'name': 'day', 'src': '모레', 'value': 2 },
|
453
|
+
{ 'name': 'sign', 'src': '전', 'value': -1 },
|
454
|
+
{ 'name': 'sign', 'src': '후', 'value': 1 },
|
455
|
+
{ 'name': 'shift', 'src': '지난|작', 'value': -1 },
|
456
|
+
{ 'name': 'shift', 'src': '이번', 'value': 0 },
|
457
|
+
{ 'name': 'shift', 'src': '다음|내', 'value': 1 }
|
458
|
+
],
|
459
|
+
'dateParse': [
|
460
|
+
'{num}{unit} {sign}',
|
461
|
+
'{shift?} {unit=5-7}'
|
462
|
+
],
|
463
|
+
'timeParse': [
|
464
|
+
'{shift} {unit=5?} {weekday}',
|
465
|
+
'{year}년{month?}월?{date?}일?',
|
466
|
+
'{month}월{date?}일?',
|
467
|
+
'{date}일'
|
468
|
+
]
|
469
|
+
});
|
470
|
+
|
471
|
+
/*
|
472
|
+
*
|
473
|
+
* Date.addLocale(<code>) adds this locale to Sugar.
|
474
|
+
* To set the locale globally, simply call:
|
475
|
+
*
|
476
|
+
* Date.setLocale('pl');
|
477
|
+
*
|
478
|
+
* var locale = Date.getLocale(<code>) will return this object, which
|
479
|
+
* can be tweaked to change the behavior of parsing/formatting in the locales.
|
480
|
+
*
|
481
|
+
* locale.addFormat adds a date format (see this file for examples).
|
482
|
+
* Special tokens in the date format will be parsed out into regex tokens:
|
483
|
+
*
|
484
|
+
* {0} is a reference to an entry in locale.optionals. Output: (?:the)?
|
485
|
+
* {unit} is a reference to all units. Output: (day|week|month|...)
|
486
|
+
* {unit3} is a reference to a specific unit. Output: (hour)
|
487
|
+
* {unit3-5} is a reference to a subset of the units array. Output: (hour|day|week)
|
488
|
+
* {unit?} "?" makes that token optional. Output: (day|week|month)?
|
489
|
+
*
|
490
|
+
* {day} Any reference to tokens in the modifiers array will include all with the same name. Output: (yesterday|today|tomorrow)
|
491
|
+
*
|
492
|
+
* All spaces are optional and will be converted to "\s*"
|
493
|
+
*
|
494
|
+
* Locale arrays months, weekdays, units, numbers, as well as the "src" field for
|
495
|
+
* all entries in the modifiers array follow a special format indicated by a colon:
|
496
|
+
*
|
497
|
+
* minute:|s = minute|minutes
|
498
|
+
* thicke:n|r = thicken|thicker
|
499
|
+
*
|
500
|
+
* Additionally in the months, weekdays, units, and numbers array these will be added at indexes that are multiples
|
501
|
+
* of the relevant number for retrieval. For example having "sunday:|s" in the units array will result in:
|
502
|
+
*
|
503
|
+
* units: ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sundays']
|
504
|
+
*
|
505
|
+
* When matched, the index will be found using:
|
506
|
+
*
|
507
|
+
* units.indexOf(match) % 7;
|
508
|
+
*
|
509
|
+
* Resulting in the correct index with any number of alternates for that entry.
|
510
|
+
*
|
511
|
+
*/
|
512
|
+
|
513
|
+
Date.addLocale('pl', {
|
514
|
+
'plural': true,
|
515
|
+
'months': 'Styczeń|Stycznia,Luty|Lutego,Marzec|Marca,Kwiecień|Kwietnia,Maj|Maja,Czerwiec|Czerwca,Lipiec|Lipca,Sierpień|Sierpnia,Wrzesień|Września,Październik|Października,Listopad|Listopada,Grudzień|Grudnia',
|
516
|
+
'weekdays': 'Niedziela|Niedzielę,Poniedziałek,Wtorek,Środ:a|ę,Czwartek,Piątek,Sobota|Sobotę',
|
517
|
+
'units': 'milisekund:a|y|,sekund:a|y|,minut:a|y|,godzin:a|y|,dzień|dni,tydzień|tygodnie|tygodni,miesiące|miesiące|miesięcy,rok|lata|lat',
|
518
|
+
'numbers': 'jeden|jedną,dwa|dwie,trzy,cztery,pięć,sześć,siedem,osiem,dziewięć,dziesięć',
|
519
|
+
'optionals': 'w|we,roku',
|
520
|
+
'short': '{d} {Month} {yyyy}',
|
521
|
+
'long': '{d} {Month} {yyyy} {H}:{mm}',
|
522
|
+
'full' : '{Weekday}, {d} {Month} {yyyy} {H}:{mm}:{ss}',
|
523
|
+
'past': '{num} {unit} {sign}',
|
524
|
+
'future': '{sign} {num} {unit}',
|
525
|
+
'duration': '{num} {unit}',
|
526
|
+
'timeMarker':'o',
|
527
|
+
'ampm': 'am,pm',
|
528
|
+
'modifiers': [
|
529
|
+
{ 'name': 'day', 'src': 'przedwczoraj', 'value': -2 },
|
530
|
+
{ 'name': 'day', 'src': 'wczoraj', 'value': -1 },
|
531
|
+
{ 'name': 'day', 'src': 'dzisiaj|dziś', 'value': 0 },
|
532
|
+
{ 'name': 'day', 'src': 'jutro', 'value': 1 },
|
533
|
+
{ 'name': 'day', 'src': 'pojutrze', 'value': 2 },
|
534
|
+
{ 'name': 'sign', 'src': 'temu|przed', 'value': -1 },
|
535
|
+
{ 'name': 'sign', 'src': 'za', 'value': 1 },
|
536
|
+
{ 'name': 'shift', 'src': 'zeszły|zeszła|ostatni|ostatnia', 'value': -1 },
|
537
|
+
{ 'name': 'shift', 'src': 'następny|następna|następnego|przyszły|przyszła|przyszłego', 'value': 1 }
|
538
|
+
],
|
539
|
+
'dateParse': [
|
540
|
+
'{num} {unit} {sign}',
|
541
|
+
'{sign} {num} {unit}',
|
542
|
+
'{month} {year}',
|
543
|
+
'{shift} {unit=5-7}',
|
544
|
+
'{0} {shift?} {weekday}'
|
545
|
+
],
|
546
|
+
'timeParse': [
|
547
|
+
'{date} {month} {year?} {1}',
|
548
|
+
'{0} {shift?} {weekday}'
|
549
|
+
]
|
550
|
+
});
|
551
|
+
|
552
|
+
/*
|
553
|
+
*
|
554
|
+
* Date.addLocale(<code>) adds this locale to Sugar.
|
555
|
+
* To set the locale globally, simply call:
|
556
|
+
*
|
557
|
+
* Date.setLocale('pt');
|
558
|
+
*
|
559
|
+
* var locale = Date.getLocale(<code>) will return this object, which
|
560
|
+
* can be tweaked to change the behavior of parsing/formatting in the locales.
|
561
|
+
*
|
562
|
+
* locale.addFormat adds a date format (see this file for examples).
|
563
|
+
* Special tokens in the date format will be parsed out into regex tokens:
|
564
|
+
*
|
565
|
+
* {0} is a reference to an entry in locale.optionals. Output: (?:the)?
|
566
|
+
* {unit} is a reference to all units. Output: (day|week|month|...)
|
567
|
+
* {unit3} is a reference to a specific unit. Output: (hour)
|
568
|
+
* {unit3-5} is a reference to a subset of the units array. Output: (hour|day|week)
|
569
|
+
* {unit?} "?" makes that token optional. Output: (day|week|month)?
|
570
|
+
*
|
571
|
+
* {day} Any reference to tokens in the modifiers array will include all with the same name. Output: (yesterday|today|tomorrow)
|
572
|
+
*
|
573
|
+
* All spaces are optional and will be converted to "\s*"
|
574
|
+
*
|
575
|
+
* Locale arrays months, weekdays, units, numbers, as well as the "src" field for
|
576
|
+
* all entries in the modifiers array follow a special format indicated by a colon:
|
577
|
+
*
|
578
|
+
* minute:|s = minute|minutes
|
579
|
+
* thicke:n|r = thicken|thicker
|
580
|
+
*
|
581
|
+
* Additionally in the months, weekdays, units, and numbers array these will be added at indexes that are multiples
|
582
|
+
* of the relevant number for retrieval. For example having "sunday:|s" in the units array will result in:
|
583
|
+
*
|
584
|
+
* units: ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sundays']
|
585
|
+
*
|
586
|
+
* When matched, the index will be found using:
|
587
|
+
*
|
588
|
+
* units.indexOf(match) % 7;
|
589
|
+
*
|
590
|
+
* Resulting in the correct index with any number of alternates for that entry.
|
591
|
+
*
|
592
|
+
*/
|
593
|
+
|
594
|
+
Date.addLocale('pt', {
|
595
|
+
'plural': true,
|
596
|
+
'months': 'janeiro,fevereiro,março,abril,maio,junho,julho,agosto,setembro,outubro,novembro,dezembro',
|
597
|
+
'weekdays': 'domingo,segunda-feira,terça-feira,quarta-feira,quinta-feira,sexta-feira,sábado|sabado',
|
598
|
+
'units': 'milisegundo:|s,segundo:|s,minuto:|s,hora:|s,dia:|s,semana:|s,mês|mêses|mes|meses,ano:|s',
|
599
|
+
'numbers': 'um,dois,três|tres,quatro,cinco,seis,sete,oito,nove,dez,uma,duas',
|
600
|
+
'optionals': 'a,de',
|
601
|
+
'short':'{d} de {month} de {yyyy}',
|
602
|
+
'long': '{d} de {month} de {yyyy} {H}:{mm}',
|
603
|
+
'full': '{Weekday}, {d} de {month} de {yyyy} {H}:{mm}:{ss}',
|
604
|
+
'past': '{num} {unit} {sign}',
|
605
|
+
'future': '{sign} {num} {unit}',
|
606
|
+
'duration': '{num} {unit}',
|
607
|
+
'timeMarker': 'às',
|
608
|
+
'ampm': 'am,pm',
|
609
|
+
'modifiers': [
|
610
|
+
{ 'name': 'day', 'src': 'anteontem', 'value': -2 },
|
611
|
+
{ 'name': 'day', 'src': 'ontem', 'value': -1 },
|
612
|
+
{ 'name': 'day', 'src': 'hoje', 'value': 0 },
|
613
|
+
{ 'name': 'day', 'src': 'amanh:ã|a', 'value': 1 },
|
614
|
+
{ 'name': 'sign', 'src': 'atrás|atras|há|ha', 'value': -1 },
|
615
|
+
{ 'name': 'sign', 'src': 'daqui a', 'value': 1 },
|
616
|
+
{ 'name': 'shift', 'src': 'passad:o|a', 'value': -1 },
|
617
|
+
{ 'name': 'shift', 'src': 'próximo|próxima|proximo|proxima', 'value': 1 }
|
618
|
+
],
|
619
|
+
'dateParse': [
|
620
|
+
'{num} {unit} {sign}',
|
621
|
+
'{sign} {num} {unit}',
|
622
|
+
'{0} {unit=5-7} {shift}',
|
623
|
+
'{0} {shift} {unit=5-7}'
|
624
|
+
],
|
625
|
+
'timeParse': [
|
626
|
+
'{date?} {1} {month} {1} {year?}',
|
627
|
+
'{0} {shift} {weekday}'
|
628
|
+
]
|
629
|
+
});
|
630
|
+
|
631
|
+
/*
|
632
|
+
*
|
633
|
+
* Date.addLocale(<code>) adds this locale to Sugar.
|
634
|
+
* To set the locale globally, simply call:
|
635
|
+
*
|
636
|
+
* Date.setLocale('ru');
|
637
|
+
*
|
638
|
+
* var locale = Date.getLocale(<code>) will return this object, which
|
639
|
+
* can be tweaked to change the behavior of parsing/formatting in the locales.
|
640
|
+
*
|
641
|
+
* locale.addFormat adds a date format (see this file for examples).
|
642
|
+
* Special tokens in the date format will be parsed out into regex tokens:
|
643
|
+
*
|
644
|
+
* {0} is a reference to an entry in locale.optionals. Output: (?:the)?
|
645
|
+
* {unit} is a reference to all units. Output: (day|week|month|...)
|
646
|
+
* {unit3} is a reference to a specific unit. Output: (hour)
|
647
|
+
* {unit3-5} is a reference to a subset of the units array. Output: (hour|day|week)
|
648
|
+
* {unit?} "?" makes that token optional. Output: (day|week|month)?
|
649
|
+
*
|
650
|
+
* {day} Any reference to tokens in the modifiers array will include all with the same name. Output: (yesterday|today|tomorrow)
|
651
|
+
*
|
652
|
+
* All spaces are optional and will be converted to "\s*"
|
653
|
+
*
|
654
|
+
* Locale arrays months, weekdays, units, numbers, as well as the "src" field for
|
655
|
+
* all entries in the modifiers array follow a special format indicated by a colon:
|
656
|
+
*
|
657
|
+
* minute:|s = minute|minutes
|
658
|
+
* thicke:n|r = thicken|thicker
|
659
|
+
*
|
660
|
+
* Additionally in the months, weekdays, units, and numbers array these will be added at indexes that are multiples
|
661
|
+
* of the relevant number for retrieval. For example having "sunday:|s" in the units array will result in:
|
662
|
+
*
|
663
|
+
* units: ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sundays']
|
664
|
+
*
|
665
|
+
* When matched, the index will be found using:
|
666
|
+
*
|
667
|
+
* units.indexOf(match) % 7;
|
668
|
+
*
|
669
|
+
* Resulting in the correct index with any number of alternates for that entry.
|
670
|
+
*
|
671
|
+
*/
|
672
|
+
|
673
|
+
Date.addLocale('ru', {
|
674
|
+
'months': 'Январ:я|ь,Феврал:я|ь,Март:а|,Апрел:я|ь,Ма:я|й,Июн:я|ь,Июл:я|ь,Август:а|,Сентябр:я|ь,Октябр:я|ь,Ноябр:я|ь,Декабр:я|ь',
|
675
|
+
'weekdays': 'Воскресенье,Понедельник,Вторник,Среда,Четверг,Пятница,Суббота',
|
676
|
+
'units': 'миллисекунд:а|у|ы|,секунд:а|у|ы|,минут:а|у|ы|,час:||а|ов,день|день|дня|дней,недел:я|ю|и|ь|е,месяц:||а|ев|е,год|год|года|лет|году',
|
677
|
+
'numbers': 'од:ин|ну,дв:а|е,три,четыре,пять,шесть,семь,восемь,девять,десять',
|
678
|
+
'optionals': 'в|на,года',
|
679
|
+
'short':'{d} {month} {yyyy} года',
|
680
|
+
'long': '{d} {month} {yyyy} года {H}:{mm}',
|
681
|
+
'full': '{Weekday} {d} {month} {yyyy} года {H}:{mm}:{ss}',
|
682
|
+
'past': '{num} {unit} {sign}',
|
683
|
+
'future': '{sign} {num} {unit}',
|
684
|
+
'duration': '{num} {unit}',
|
685
|
+
'timeMarker': 'в',
|
686
|
+
'ampm': ' утра, вечера',
|
687
|
+
'modifiers': [
|
688
|
+
{ 'name': 'day', 'src': 'позавчера', 'value': -2 },
|
689
|
+
{ 'name': 'day', 'src': 'вчера', 'value': -1 },
|
690
|
+
{ 'name': 'day', 'src': 'сегодня', 'value': 0 },
|
691
|
+
{ 'name': 'day', 'src': 'завтра', 'value': 1 },
|
692
|
+
{ 'name': 'day', 'src': 'послезавтра', 'value': 2 },
|
693
|
+
{ 'name': 'sign', 'src': 'назад', 'value': -1 },
|
694
|
+
{ 'name': 'sign', 'src': 'через', 'value': 1 },
|
695
|
+
{ 'name': 'shift', 'src': 'прошл:ый|ой|ом', 'value': -1 },
|
696
|
+
{ 'name': 'shift', 'src': 'следующ:ий|ей|ем', 'value': 1 }
|
697
|
+
],
|
698
|
+
'dateParse': [
|
699
|
+
'{num} {unit} {sign}',
|
700
|
+
'{sign} {num} {unit}',
|
701
|
+
'{month} {year}',
|
702
|
+
'{0} {shift} {unit=5-7}'
|
703
|
+
],
|
704
|
+
'timeParse': [
|
705
|
+
'{date} {month} {year?} {1}',
|
706
|
+
'{0} {shift} {weekday}'
|
707
|
+
]
|
708
|
+
});
|
709
|
+
|
710
|
+
/*
|
711
|
+
*
|
712
|
+
* Date.addLocale(<code>) adds this locale to Sugar.
|
713
|
+
* To set the locale globally, simply call:
|
714
|
+
*
|
715
|
+
* Date.setLocale('sv');
|
716
|
+
*
|
717
|
+
* var locale = Date.getLocale(<code>) will return this object, which
|
718
|
+
* can be tweaked to change the behavior of parsing/formatting in the locales.
|
719
|
+
*
|
720
|
+
* locale.addFormat adds a date format (see this file for examples).
|
721
|
+
* Special tokens in the date format will be parsed out into regex tokens:
|
722
|
+
*
|
723
|
+
* {0} is a reference to an entry in locale.optionals. Output: (?:the)?
|
724
|
+
* {unit} is a reference to all units. Output: (day|week|month|...)
|
725
|
+
* {unit3} is a reference to a specific unit. Output: (hour)
|
726
|
+
* {unit3-5} is a reference to a subset of the units array. Output: (hour|day|week)
|
727
|
+
* {unit?} "?" makes that token optional. Output: (day|week|month)?
|
728
|
+
*
|
729
|
+
* {day} Any reference to tokens in the modifiers array will include all with the same name. Output: (yesterday|today|tomorrow)
|
730
|
+
*
|
731
|
+
* All spaces are optional and will be converted to "\s*"
|
732
|
+
*
|
733
|
+
* Locale arrays months, weekdays, units, numbers, as well as the "src" field for
|
734
|
+
* all entries in the modifiers array follow a special format indicated by a colon:
|
735
|
+
*
|
736
|
+
* minute:|s = minute|minutes
|
737
|
+
* thicke:n|r = thicken|thicker
|
738
|
+
*
|
739
|
+
* Additionally in the months, weekdays, units, and numbers array these will be added at indexes that are multiples
|
740
|
+
* of the relevant number for retrieval. For example having "sunday:|s" in the units array will result in:
|
741
|
+
*
|
742
|
+
* units: ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sundays']
|
743
|
+
*
|
744
|
+
* When matched, the index will be found using:
|
745
|
+
*
|
746
|
+
* units.indexOf(match) % 7;
|
747
|
+
*
|
748
|
+
* Resulting in the correct index with any number of alternates for that entry.
|
749
|
+
*
|
750
|
+
*/
|
751
|
+
|
752
|
+
Date.addLocale('sv', {
|
753
|
+
'plural': true,
|
754
|
+
'months': 'januari,februari,mars,april,maj,juni,juli,augusti,september,oktober,november,december',
|
755
|
+
'weekdays': 'söndag|sondag,måndag:|en+mandag:|en,tisdag,onsdag,torsdag,fredag,lördag|lordag',
|
756
|
+
'units': 'millisekund:|er,sekund:|er,minut:|er,timm:e|ar,dag:|ar,veck:a|or|an,månad:|er|en+manad:|er|en,år:||et+ar:||et',
|
757
|
+
'numbers': 'en|ett,två|tva,tre,fyra,fem,sex,sju,åtta|atta,nio,tio',
|
758
|
+
'optionals': 'den,för|for',
|
759
|
+
'articles': 'den',
|
760
|
+
'short':'den {d} {month} {yyyy}',
|
761
|
+
'long': 'den {d} {month} {yyyy} {H}:{mm}',
|
762
|
+
'full': '{Weekday} den {d} {month} {yyyy} {H}:{mm}:{ss}',
|
763
|
+
'past': '{num} {unit} {sign}',
|
764
|
+
'future': '{sign} {num} {unit}',
|
765
|
+
'duration': '{num} {unit}',
|
766
|
+
'ampm': 'am,pm',
|
767
|
+
'modifiers': [
|
768
|
+
{ 'name': 'day', 'src': 'förrgår|i förrgår|iförrgår|forrgar|i forrgar|iforrgar', 'value': -2 },
|
769
|
+
{ 'name': 'day', 'src': 'går|i går|igår|gar|i gar|igar', 'value': -1 },
|
770
|
+
{ 'name': 'day', 'src': 'dag|i dag|idag', 'value': 0 },
|
771
|
+
{ 'name': 'day', 'src': 'morgon|i morgon|imorgon', 'value': 1 },
|
772
|
+
{ 'name': 'day', 'src': 'över morgon|övermorgon|i över morgon|i övermorgon|iövermorgon|over morgon|overmorgon|i over morgon|i overmorgon|iovermorgon', 'value': 2 },
|
773
|
+
{ 'name': 'sign', 'src': 'sedan|sen', 'value': -1 },
|
774
|
+
{ 'name': 'sign', 'src': 'om', 'value': 1 },
|
775
|
+
{ 'name': 'shift', 'src': 'i förra|förra|i forra|forra', 'value': -1 },
|
776
|
+
{ 'name': 'shift', 'src': 'denna', 'value': 0 },
|
777
|
+
{ 'name': 'shift', 'src': 'nästa|nasta', 'value': 1 }
|
778
|
+
],
|
779
|
+
'dateParse': [
|
780
|
+
'{num} {unit} {sign}',
|
781
|
+
'{sign} {num} {unit}',
|
782
|
+
'{1} {num} {unit} {sign}',
|
783
|
+
'{shift} {unit5-7}'
|
784
|
+
],
|
785
|
+
'timeParse': [
|
786
|
+
'{0} {weekday?} {date?} {month} {year}',
|
787
|
+
'{date} {month}',
|
788
|
+
'{shift} {weekday}'
|
789
|
+
]
|
790
|
+
});
|
791
|
+
|
792
|
+
/*
|
793
|
+
*
|
794
|
+
* Date.addLocale(<code>) adds this locale to Sugar.
|
795
|
+
* To set the locale globally, simply call:
|
796
|
+
*
|
797
|
+
* Date.setLocale('zh-CN');
|
798
|
+
*
|
799
|
+
* var locale = Date.getLocale(<code>) will return this object, which
|
800
|
+
* can be tweaked to change the behavior of parsing/formatting in the locales.
|
801
|
+
*
|
802
|
+
* locale.addFormat adds a date format (see this file for examples).
|
803
|
+
* Special tokens in the date format will be parsed out into regex tokens:
|
804
|
+
*
|
805
|
+
* {0} is a reference to an entry in locale.optionals. Output: (?:the)?
|
806
|
+
* {unit} is a reference to all units. Output: (day|week|month|...)
|
807
|
+
* {unit3} is a reference to a specific unit. Output: (hour)
|
808
|
+
* {unit3-5} is a reference to a subset of the units array. Output: (hour|day|week)
|
809
|
+
* {unit?} "?" makes that token optional. Output: (day|week|month)?
|
810
|
+
*
|
811
|
+
* {day} Any reference to tokens in the modifiers array will include all with the same name. Output: (yesterday|today|tomorrow)
|
812
|
+
*
|
813
|
+
* All spaces are optional and will be converted to "\s*"
|
814
|
+
*
|
815
|
+
* Locale arrays months, weekdays, units, numbers, as well as the "src" field for
|
816
|
+
* all entries in the modifiers array follow a special format indicated by a colon:
|
817
|
+
*
|
818
|
+
* minute:|s = minute|minutes
|
819
|
+
* thicke:n|r = thicken|thicker
|
820
|
+
*
|
821
|
+
* Additionally in the months, weekdays, units, and numbers array these will be added at indexes that are multiples
|
822
|
+
* of the relevant number for retrieval. For example having "sunday:|s" in the units array will result in:
|
823
|
+
*
|
824
|
+
* units: ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sundays']
|
825
|
+
*
|
826
|
+
* When matched, the index will be found using:
|
827
|
+
*
|
828
|
+
* units.indexOf(match) % 7;
|
829
|
+
*
|
830
|
+
* Resulting in the correct index with any number of alternates for that entry.
|
831
|
+
*
|
832
|
+
*/
|
833
|
+
|
834
|
+
Date.addLocale('zh-CN', {
|
835
|
+
'variant': true,
|
836
|
+
'monthSuffix': '月',
|
837
|
+
'weekdays': '星期日|周日,星期一|周一,星期二|周二,星期三|周三,星期四|周四,星期五|周五,星期六|周六',
|
838
|
+
'units': '毫秒,秒钟,分钟,小时,天,个星期|周,个月,年',
|
839
|
+
'optionals': '日|号',
|
840
|
+
'short':'{yyyy}年{M}月{d}日',
|
841
|
+
'long': '{yyyy}年{M}月{d}日 {tt}{h}:{mm}',
|
842
|
+
'full': '{yyyy}年{M}月{d}日 {weekday} {tt}{h}:{mm}:{ss}',
|
843
|
+
'past': '{num}{unit}{sign}',
|
844
|
+
'future': '{num}{unit}{sign}',
|
845
|
+
'duration': '{num}{unit}',
|
846
|
+
'timeSuffixes': '点|时,分钟?,秒',
|
847
|
+
'ampm': '上午,下午',
|
848
|
+
'modifiers': [
|
849
|
+
{ 'name': 'day', 'src': '前天', 'value': -2 },
|
850
|
+
{ 'name': 'day', 'src': '昨天', 'value': -1 },
|
851
|
+
{ 'name': 'day', 'src': '今天', 'value': 0 },
|
852
|
+
{ 'name': 'day', 'src': '明天', 'value': 1 },
|
853
|
+
{ 'name': 'day', 'src': '后天', 'value': 2 },
|
854
|
+
{ 'name': 'sign', 'src': '前', 'value': -1 },
|
855
|
+
{ 'name': 'sign', 'src': '后', 'value': 1 },
|
856
|
+
{ 'name': 'shift', 'src': '上|去', 'value': -1 },
|
857
|
+
{ 'name': 'shift', 'src': '这', 'value': 0 },
|
858
|
+
{ 'name': 'shift', 'src': '下|明', 'value': 1 }
|
859
|
+
],
|
860
|
+
'dateParse': [
|
861
|
+
'{num}{unit}{sign}',
|
862
|
+
'{shift}{unit=5-7}'
|
863
|
+
],
|
864
|
+
'timeParse': [
|
865
|
+
'{shift}{weekday}',
|
866
|
+
'{year}年{month?}月?{date?}{0}',
|
867
|
+
'{month}月{date?}{0}',
|
868
|
+
'{date}{0}'
|
869
|
+
]
|
870
|
+
});
|
871
|
+
|
872
|
+
/*
|
873
|
+
*
|
874
|
+
* Date.addLocale(<code>) adds this locale to Sugar.
|
875
|
+
* To set the locale globally, simply call:
|
876
|
+
*
|
877
|
+
* Date.setLocale('zh-TW');
|
878
|
+
*
|
879
|
+
* var locale = Date.getLocale(<code>) will return this object, which
|
880
|
+
* can be tweaked to change the behavior of parsing/formatting in the locales.
|
881
|
+
*
|
882
|
+
* locale.addFormat adds a date format (see this file for examples).
|
883
|
+
* Special tokens in the date format will be parsed out into regex tokens:
|
884
|
+
*
|
885
|
+
* {0} is a reference to an entry in locale.optionals. Output: (?:the)?
|
886
|
+
* {unit} is a reference to all units. Output: (day|week|month|...)
|
887
|
+
* {unit3} is a reference to a specific unit. Output: (hour)
|
888
|
+
* {unit3-5} is a reference to a subset of the units array. Output: (hour|day|week)
|
889
|
+
* {unit?} "?" makes that token optional. Output: (day|week|month)?
|
890
|
+
*
|
891
|
+
* {day} Any reference to tokens in the modifiers array will include all with the same name. Output: (yesterday|today|tomorrow)
|
892
|
+
*
|
893
|
+
* All spaces are optional and will be converted to "\s*"
|
894
|
+
*
|
895
|
+
* Locale arrays months, weekdays, units, numbers, as well as the "src" field for
|
896
|
+
* all entries in the modifiers array follow a special format indicated by a colon:
|
897
|
+
*
|
898
|
+
* minute:|s = minute|minutes
|
899
|
+
* thicke:n|r = thicken|thicker
|
900
|
+
*
|
901
|
+
* Additionally in the months, weekdays, units, and numbers array these will be added at indexes that are multiples
|
902
|
+
* of the relevant number for retrieval. For example having "sunday:|s" in the units array will result in:
|
903
|
+
*
|
904
|
+
* units: ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sundays']
|
905
|
+
*
|
906
|
+
* When matched, the index will be found using:
|
907
|
+
*
|
908
|
+
* units.indexOf(match) % 7;
|
909
|
+
*
|
910
|
+
* Resulting in the correct index with any number of alternates for that entry.
|
911
|
+
*
|
912
|
+
*/
|
913
|
+
|
914
|
+
//'zh-TW': '1;月;年;;星期日|週日,星期一|週一,星期二|週二,星期三|週三,星期四|週四,星期五|週五,星期六|週六;毫秒,秒鐘,分鐘,小時,天,個星期|週,個月,年;;;日|號;;上午,下午;點|時,分鐘?,秒;{num}{unit}{sign},{shift}{unit=5-7};{shift}{weekday},{year}年{month?}月?{date?}{0},{month}月{date?}{0},{date}{0};{yyyy}年{M}月{d}日 {Weekday};{tt}{h}:{mm}:{ss};前天,昨天,今天,明天,後天;,前,,後;,上|去,這,下|明',
|
915
|
+
|
916
|
+
Date.addLocale('zh-TW', {
|
917
|
+
'monthSuffix': '月',
|
918
|
+
'weekdays': '星期日|週日,星期一|週一,星期二|週二,星期三|週三,星期四|週四,星期五|週五,星期六|週六',
|
919
|
+
'units': '毫秒,秒鐘,分鐘,小時,天,個星期|週,個月,年',
|
920
|
+
'optionals': '日|號',
|
921
|
+
'short':'{yyyy}年{M}月{d}日',
|
922
|
+
'long': '{yyyy}年{M}月{d}日 {tt}{h}:{mm}',
|
923
|
+
'full': '{yyyy}年{M}月{d}日 {Weekday} {tt}{h}:{mm}:{ss}',
|
924
|
+
'past': '{num}{unit}{sign}',
|
925
|
+
'future': '{num}{unit}{sign}',
|
926
|
+
'duration': '{num}{unit}',
|
927
|
+
'timeSuffixes': '點|時,分鐘?,秒',
|
928
|
+
'ampm': '上午,下午',
|
929
|
+
'modifiers': [
|
930
|
+
{ 'name': 'day', 'src': '前天', 'value': -2 },
|
931
|
+
{ 'name': 'day', 'src': '昨天', 'value': -1 },
|
932
|
+
{ 'name': 'day', 'src': '今天', 'value': 0 },
|
933
|
+
{ 'name': 'day', 'src': '明天', 'value': 1 },
|
934
|
+
{ 'name': 'day', 'src': '後天', 'value': 2 },
|
935
|
+
{ 'name': 'sign', 'src': '前', 'value': -1 },
|
936
|
+
{ 'name': 'sign', 'src': '後', 'value': 1 },
|
937
|
+
{ 'name': 'shift', 'src': '上|去', 'value': -1 },
|
938
|
+
{ 'name': 'shift', 'src': '這', 'value': 0 },
|
939
|
+
{ 'name': 'shift', 'src': '下|明', 'value': 1 }
|
940
|
+
],
|
941
|
+
'dateParse': [
|
942
|
+
'{num}{unit}{sign}',
|
943
|
+
'{shift}{unit=5-7}'
|
944
|
+
],
|
945
|
+
'timeParse': [
|
946
|
+
'{shift}{weekday}',
|
947
|
+
'{year}年{month?}月?{date?}{0}',
|
948
|
+
'{month}月{date?}{0}',
|
949
|
+
'{date}{0}'
|
950
|
+
]
|
951
|
+
});
|
952
|
+
|