sugar-rails 1.3.7 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +7 -0
  2. data/.ruby-gemset +1 -0
  3. data/.ruby-version +1 -0
  4. data/README.md +3 -50
  5. data/{vendor → app}/assets/javascripts/sugar-development.js +1914 -1225
  6. data/app/assets/javascripts/sugar-full.js +200 -0
  7. data/app/assets/javascripts/sugar.js +132 -0
  8. data/copy_release.sh +4 -7
  9. data/lib/sugar/rails/version.rb +2 -2
  10. metadata +16 -58
  11. data/.rvmrc +0 -1
  12. data/lib/generators/sugar/build/build_generator.rb +0 -107
  13. data/lib/generators/sugar/install/install_generator.rb +0 -35
  14. data/vendor/assets/javascripts/precompiled/development/array.js +0 -1203
  15. data/vendor/assets/javascripts/precompiled/development/core.js +0 -365
  16. data/vendor/assets/javascripts/precompiled/development/date.js +0 -2267
  17. data/vendor/assets/javascripts/precompiled/development/date_locales.js +0 -1179
  18. data/vendor/assets/javascripts/precompiled/development/date_ranges.js +0 -208
  19. data/vendor/assets/javascripts/precompiled/development/es5.js +0 -474
  20. data/vendor/assets/javascripts/precompiled/development/function.js +0 -224
  21. data/vendor/assets/javascripts/precompiled/development/inflections.js +0 -410
  22. data/vendor/assets/javascripts/precompiled/development/language.js +0 -383
  23. data/vendor/assets/javascripts/precompiled/development/number.js +0 -428
  24. data/vendor/assets/javascripts/precompiled/development/object.js +0 -419
  25. data/vendor/assets/javascripts/precompiled/development/regexp.js +0 -92
  26. data/vendor/assets/javascripts/precompiled/development/string.js +0 -894
  27. data/vendor/assets/javascripts/precompiled/minified/array.js +0 -18
  28. data/vendor/assets/javascripts/precompiled/minified/core.js +0 -9
  29. data/vendor/assets/javascripts/precompiled/minified/date.js +0 -44
  30. data/vendor/assets/javascripts/precompiled/minified/date_locales.js +0 -49
  31. data/vendor/assets/javascripts/precompiled/minified/date_ranges.js +0 -4
  32. data/vendor/assets/javascripts/precompiled/minified/es5.js +0 -8
  33. data/vendor/assets/javascripts/precompiled/minified/function.js +0 -4
  34. data/vendor/assets/javascripts/precompiled/minified/inflections.js +0 -11
  35. data/vendor/assets/javascripts/precompiled/minified/language.js +0 -19
  36. data/vendor/assets/javascripts/precompiled/minified/number.js +0 -5
  37. data/vendor/assets/javascripts/precompiled/minified/object.js +0 -6
  38. data/vendor/assets/javascripts/precompiled/minified/regexp.js +0 -2
  39. data/vendor/assets/javascripts/precompiled/minified/string.js +0 -12
  40. data/vendor/assets/javascripts/precompiled/readme.txt +0 -3
  41. data/vendor/assets/javascripts/sugar-full.js +0 -199
  42. data/vendor/assets/javascripts/sugar.js +0 -120
@@ -1,1179 +0,0 @@
1
- /*
2
- *
3
- * Date.addLocale(<code>) adds this locale to Sugar.
4
- * To set the locale globally, simply call:
5
- *
6
- * Date.setLocale('da');
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
-
43
- Date.addLocale('da', {
44
- 'plural': true,
45
- 'months': 'januar,februar,marts,april,maj,juni,juli,august,september,oktober,november,december',
46
- 'weekdays': 'søndag|sondag,mandag,tirsdag,onsdag,torsdag,fredag,lørdag|lordag',
47
- 'units': 'millisekund:|er,sekund:|er,minut:|ter,tim:e|er,dag:|e,ug:e|er|en,måned:|er|en+maaned:|er|en,år:||et+aar:||et',
48
- 'numbers': 'en|et,to,tre,fire,fem,seks,syv,otte,ni,ti',
49
- 'tokens': 'den,for',
50
- 'articles': 'den',
51
- 'short':'d. {d}. {month} {yyyy}',
52
- 'long': 'den {d}. {month} {yyyy} {H}:{mm}',
53
- 'full': '{Weekday} den {d}. {month} {yyyy} {H}:{mm}:{ss}',
54
- 'past': '{num} {unit} {sign}',
55
- 'future': '{sign} {num} {unit}',
56
- 'duration': '{num} {unit}',
57
- 'ampm': 'am,pm',
58
- 'modifiers': [
59
- { 'name': 'day', 'src': 'forgårs|i forgårs|forgaars|i forgaars', 'value': -2 },
60
- { 'name': 'day', 'src': 'i går|igår|i gaar|igaar', 'value': -1 },
61
- { 'name': 'day', 'src': 'i dag|idag', 'value': 0 },
62
- { 'name': 'day', 'src': 'i morgen|imorgen', 'value': 1 },
63
- { 'name': 'day', 'src': 'over morgon|overmorgen|i over morgen|i overmorgen|iovermorgen', 'value': 2 },
64
- { 'name': 'sign', 'src': 'siden', 'value': -1 },
65
- { 'name': 'sign', 'src': 'om', 'value': 1 },
66
- { 'name': 'shift', 'src': 'i sidste|sidste', 'value': -1 },
67
- { 'name': 'shift', 'src': 'denne', 'value': 0 },
68
- { 'name': 'shift', 'src': 'næste|naeste', 'value': 1 }
69
- ],
70
- 'dateParse': [
71
- '{num} {unit} {sign}',
72
- '{sign} {num} {unit}',
73
- '{1?} {num} {unit} {sign}',
74
- '{shift} {unit=5-7}'
75
- ],
76
- 'timeParse': [
77
- '{0?} {weekday?} {date?} {month} {year}',
78
- '{date} {month}',
79
- '{shift} {weekday}'
80
- ]
81
- });
82
-
83
- /*
84
- *
85
- * Date.addLocale(<code>) adds this locale to Sugar.
86
- * To set the locale globally, simply call:
87
- *
88
- * Date.setLocale('de');
89
- *
90
- * var locale = Date.getLocale(<code>) will return this object, which
91
- * can be tweaked to change the behavior of parsing/formatting in the locales.
92
- *
93
- * locale.addFormat adds a date format (see this file for examples).
94
- * Special tokens in the date format will be parsed out into regex tokens:
95
- *
96
- * {0} is a reference to an entry in locale.tokens. Output: (?:the)?
97
- * {unit} is a reference to all units. Output: (day|week|month|...)
98
- * {unit3} is a reference to a specific unit. Output: (hour)
99
- * {unit3-5} is a reference to a subset of the units array. Output: (hour|day|week)
100
- * {unit?} "?" makes that token optional. Output: (day|week|month)?
101
- *
102
- * {day} Any reference to tokens in the modifiers array will include all with the same name. Output: (yesterday|today|tomorrow)
103
- *
104
- * All spaces are optional and will be converted to "\s*"
105
- *
106
- * Locale arrays months, weekdays, units, numbers, as well as the "src" field for
107
- * all entries in the modifiers array follow a special format indicated by a colon:
108
- *
109
- * minute:|s = minute|minutes
110
- * thicke:n|r = thicken|thicker
111
- *
112
- * Additionally in the months, weekdays, units, and numbers array these will be added at indexes that are multiples
113
- * of the relevant number for retrieval. For example having "sunday:|s" in the units array will result in:
114
- *
115
- * units: ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sundays']
116
- *
117
- * When matched, the index will be found using:
118
- *
119
- * units.indexOf(match) % 7;
120
- *
121
- * Resulting in the correct index with any number of alternates for that entry.
122
- *
123
- */
124
-
125
- Date.addLocale('de', {
126
- 'plural': true,
127
- 'capitalizeUnit': true,
128
- 'months': 'Januar,Februar,März|Marz,April,Mai,Juni,Juli,August,September,Oktober,November,Dezember',
129
- 'weekdays': 'Sonntag,Montag,Dienstag,Mittwoch,Donnerstag,Freitag,Samstag',
130
- 'units': 'Millisekunde:|n,Sekunde:|n,Minute:|n,Stunde:|n,Tag:|en,Woche:|n,Monat:|en,Jahr:|en',
131
- 'numbers': 'ein:|e|er|en|em,zwei,drei,vier,fuenf,sechs,sieben,acht,neun,zehn',
132
- 'tokens': 'der',
133
- 'short':'{d}. {Month} {yyyy}',
134
- 'long': '{d}. {Month} {yyyy} {H}:{mm}',
135
- 'full': '{Weekday} {d}. {Month} {yyyy} {H}:{mm}:{ss}',
136
- 'past': '{sign} {num} {unit}',
137
- 'future': '{sign} {num} {unit}',
138
- 'duration': '{num} {unit}',
139
- 'timeMarker': 'um',
140
- 'ampm': 'am,pm',
141
- 'modifiers': [
142
- { 'name': 'day', 'src': 'vorgestern', 'value': -2 },
143
- { 'name': 'day', 'src': 'gestern', 'value': -1 },
144
- { 'name': 'day', 'src': 'heute', 'value': 0 },
145
- { 'name': 'day', 'src': 'morgen', 'value': 1 },
146
- { 'name': 'day', 'src': 'übermorgen|ubermorgen|uebermorgen', 'value': 2 },
147
- { 'name': 'sign', 'src': 'vor:|her', 'value': -1 },
148
- { 'name': 'sign', 'src': 'in', 'value': 1 },
149
- { 'name': 'shift', 'src': 'letzte:|r|n|s', 'value': -1 },
150
- { 'name': 'shift', 'src': 'nächste:|r|n|s+nachste:|r|n|s+naechste:|r|n|s+kommende:n|r', 'value': 1 }
151
- ],
152
- 'dateParse': [
153
- '{sign} {num} {unit}',
154
- '{num} {unit} {sign}',
155
- '{shift} {unit=5-7}'
156
- ],
157
- 'timeParse': [
158
- '{weekday?} {date?} {month} {year?}',
159
- '{shift} {weekday}'
160
- ]
161
- });
162
-
163
- /*
164
- *
165
- * Date.addLocale(<code>) adds this locale to Sugar.
166
- * To set the locale globally, simply call:
167
- *
168
- * Date.setLocale('es');
169
- *
170
- * var locale = Date.getLocale(<code>) will return this object, which
171
- * can be tweaked to change the behavior of parsing/formatting in the locales.
172
- *
173
- * locale.addFormat adds a date format (see this file for examples).
174
- * Special tokens in the date format will be parsed out into regex tokens:
175
- *
176
- * {0} is a reference to an entry in locale.tokens. Output: (?:the)?
177
- * {unit} is a reference to all units. Output: (day|week|month|...)
178
- * {unit3} is a reference to a specific unit. Output: (hour)
179
- * {unit3-5} is a reference to a subset of the units array. Output: (hour|day|week)
180
- * {unit?} "?" makes that token optional. Output: (day|week|month)?
181
- *
182
- * {day} Any reference to tokens in the modifiers array will include all with the same name. Output: (yesterday|today|tomorrow)
183
- *
184
- * All spaces are optional and will be converted to "\s*"
185
- *
186
- * Locale arrays months, weekdays, units, numbers, as well as the "src" field for
187
- * all entries in the modifiers array follow a special format indicated by a colon:
188
- *
189
- * minute:|s = minute|minutes
190
- * thicke:n|r = thicken|thicker
191
- *
192
- * Additionally in the months, weekdays, units, and numbers array these will be added at indexes that are multiples
193
- * of the relevant number for retrieval. For example having "sunday:|s" in the units array will result in:
194
- *
195
- * units: ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sundays']
196
- *
197
- * When matched, the index will be found using:
198
- *
199
- * units.indexOf(match) % 7;
200
- *
201
- * Resulting in the correct index with any number of alternates for that entry.
202
- *
203
- */
204
-
205
- Date.addLocale('es', {
206
- 'plural': true,
207
- 'months': 'enero,febrero,marzo,abril,mayo,junio,julio,agosto,septiembre,octubre,noviembre,diciembre',
208
- 'weekdays': 'domingo,lunes,martes,miércoles|miercoles,jueves,viernes,sábado|sabado',
209
- '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',
210
- 'numbers': 'uno,dos,tres,cuatro,cinco,seis,siete,ocho,nueve,diez',
211
- 'tokens': 'el,de',
212
- 'short':'{d} {month} {yyyy}',
213
- 'long': '{d} {month} {yyyy} {H}:{mm}',
214
- 'full': '{Weekday} {d} {month} {yyyy} {H}:{mm}:{ss}',
215
- 'past': '{sign} {num} {unit}',
216
- 'future': '{num} {unit} {sign}',
217
- 'duration': '{num} {unit}',
218
- 'timeMarker': 'a las',
219
- 'ampm': 'am,pm',
220
- 'modifiers': [
221
- { 'name': 'day', 'src': 'anteayer', 'value': -2 },
222
- { 'name': 'day', 'src': 'ayer', 'value': -1 },
223
- { 'name': 'day', 'src': 'hoy', 'value': 0 },
224
- { 'name': 'day', 'src': 'mañana|manana', 'value': 1 },
225
- { 'name': 'sign', 'src': 'hace', 'value': -1 },
226
- { 'name': 'sign', 'src': 'de ahora', 'value': 1 },
227
- { 'name': 'shift', 'src': 'pasad:o|a', 'value': -1 },
228
- { 'name': 'shift', 'src': 'próximo|próxima|proximo|proxima', 'value': 1 }
229
- ],
230
- 'dateParse': [
231
- '{sign} {num} {unit}',
232
- '{num} {unit} {sign}',
233
- '{0?} {unit=5-7} {shift}',
234
- '{0?} {shift} {unit=5-7}'
235
- ],
236
- 'timeParse': [
237
- '{shift} {weekday}',
238
- '{weekday} {shift}',
239
- '{date?} {1?} {month} {1?} {year?}'
240
- ]
241
- });
242
- Date.addLocale('fi', {
243
- 'plural': true,
244
- 'timeMarker': 'kello',
245
- 'ampm': ',',
246
- 'months': 'tammikuu,helmikuu,maaliskuu,huhtikuu,toukokuu,kesäkuu,heinäkuu,elokuu,syyskuu,lokakuu,marraskuu,joulukuu',
247
- 'weekdays': 'sunnuntai,maanantai,tiistai,keskiviikko,torstai,perjantai,lauantai',
248
- 'units': 'millisekun:ti|tia|teja|tina|nin,sekun:ti|tia|teja|tina|nin,minuut:ti|tia|teja|tina|in,tun:ti|tia|teja|tina|nin,päiv:ä|ää|iä|änä|än,viik:ko|koa|koja|on|kona,kuukau:si|sia|tta|den|tena,vuo:si|sia|tta|den|tena',
249
- 'numbers': 'yksi|ensimmäinen,kaksi|toinen,kolm:e|as,neljä:s,vii:si|des,kuu:si|des,seitsemä:n|s,kahdeksa:n|s,yhdeksä:n|s,kymmene:n|s',
250
- 'articles': '',
251
- 'optionals': '',
252
- 'short': '{d}. {month}ta {yyyy}',
253
- 'long': '{d}. {month}ta {yyyy} kello {H}.{mm}',
254
- 'full': '{Weekday}na {d}. {month}ta {yyyy} kello {H}.{mm}',
255
- 'relative': function(num, unit, ms, format) {
256
- var units = this['units'];
257
- function numberWithUnit(mult) {
258
- return (num === 1 ? '' : num + ' ') + units[(8 * mult) + unit];
259
- }
260
- switch(format) {
261
- case 'duration': return numberWithUnit(0);
262
- case 'past': return numberWithUnit(num > 1 ? 1 : 0) + ' sitten';
263
- case 'future': return numberWithUnit(4) + ' päästä';
264
- }
265
- },
266
- 'modifiers': [
267
- { 'name': 'day', 'src': 'toissa päivänä|toissa päiväistä', 'value': -2 },
268
- { 'name': 'day', 'src': 'eilen|eilistä', 'value': -1 },
269
- { 'name': 'day', 'src': 'tänään', 'value': 0 },
270
- { 'name': 'day', 'src': 'huomenna|huomista', 'value': 1 },
271
- { 'name': 'day', 'src': 'ylihuomenna|ylihuomista', 'value': 2 },
272
- { 'name': 'sign', 'src': 'sitten|aiemmin', 'value': -1 },
273
- { 'name': 'sign', 'src': 'päästä|kuluttua|myöhemmin', 'value': 1 },
274
- { 'name': 'edge', 'src': 'viimeinen|viimeisenä', 'value': -2 },
275
- { 'name': 'edge', 'src': 'lopussa', 'value': -1 },
276
- { 'name': 'edge', 'src': 'ensimmäinen|ensimmäisenä', 'value': 1 },
277
- { 'name': 'shift', 'src': 'edellinen|edellisenä|edeltävä|edeltävänä|viime|toissa', 'value': -1 },
278
- { 'name': 'shift', 'src': 'tänä|tämän', 'value': 0 },
279
- { 'name': 'shift', 'src': 'seuraava|seuraavana|tuleva|tulevana|ensi', 'value': 1 }
280
- ],
281
- 'dateParse': [
282
- '{num} {unit} {sign}',
283
- '{sign} {num} {unit}',
284
- '{num} {unit=4-5} {sign} {day}',
285
- '{month} {year}',
286
- '{shift} {unit=5-7}'
287
- ],
288
- 'timeParse': [
289
- '{0} {num}{1} {day} of {month} {year?}',
290
- '{weekday?} {month} {date}{1} {year?}',
291
- '{date} {month} {year}',
292
- '{shift} {weekday}',
293
- '{shift} week {weekday}',
294
- '{weekday} {2} {shift} week',
295
- '{0} {date}{1} of {month}',
296
- '{0}{month?} {date?}{1} of {shift} {unit=6-7}'
297
- ]
298
- });
299
- /*
300
- *
301
- * Date.addLocale(<code>) adds this locale to Sugar.
302
- * To set the locale globally, simply call:
303
- *
304
- * Date.setLocale('fr');
305
- *
306
- * var locale = Date.getLocale(<code>) will return this object, which
307
- * can be tweaked to change the behavior of parsing/formatting in the locales.
308
- *
309
- * locale.addFormat adds a date format (see this file for examples).
310
- * Special tokens in the date format will be parsed out into regex tokens:
311
- *
312
- * {0} is a reference to an entry in locale.tokens. Output: (?:the)?
313
- * {unit} is a reference to all units. Output: (day|week|month|...)
314
- * {unit3} is a reference to a specific unit. Output: (hour)
315
- * {unit3-5} is a reference to a subset of the units array. Output: (hour|day|week)
316
- * {unit?} "?" makes that token optional. Output: (day|week|month)?
317
- *
318
- * {day} Any reference to tokens in the modifiers array will include all with the same name. Output: (yesterday|today|tomorrow)
319
- *
320
- * All spaces are optional and will be converted to "\s*"
321
- *
322
- * Locale arrays months, weekdays, units, numbers, as well as the "src" field for
323
- * all entries in the modifiers array follow a special format indicated by a colon:
324
- *
325
- * minute:|s = minute|minutes
326
- * thicke:n|r = thicken|thicker
327
- *
328
- * Additionally in the months, weekdays, units, and numbers array these will be added at indexes that are multiples
329
- * of the relevant number for retrieval. For example having "sunday:|s" in the units array will result in:
330
- *
331
- * units: ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sundays']
332
- *
333
- * When matched, the index will be found using:
334
- *
335
- * units.indexOf(match) % 7;
336
- *
337
- * Resulting in the correct index with any number of alternates for that entry.
338
- *
339
- */
340
-
341
- Date.addLocale('fr', {
342
- 'plural': true,
343
- 'months': 'janvier,février|fevrier,mars,avril,mai,juin,juillet,août,septembre,octobre,novembre,décembre|decembre',
344
- 'weekdays': 'dimanche,lundi,mardi,mercredi,jeudi,vendredi,samedi',
345
- 'units': 'milliseconde:|s,seconde:|s,minute:|s,heure:|s,jour:|s,semaine:|s,mois,an:|s|née|nee',
346
- 'numbers': 'un:|e,deux,trois,quatre,cinq,six,sept,huit,neuf,dix',
347
- 'tokens': ["l'|la|le"],
348
- 'short':'{d} {month} {yyyy}',
349
- 'long': '{d} {month} {yyyy} {H}:{mm}',
350
- 'full': '{Weekday} {d} {month} {yyyy} {H}:{mm}:{ss}',
351
- 'past': '{sign} {num} {unit}',
352
- 'future': '{sign} {num} {unit}',
353
- 'duration': '{num} {unit}',
354
- 'timeMarker': 'à',
355
- 'ampm': 'am,pm',
356
- 'modifiers': [
357
- { 'name': 'day', 'src': 'hier', 'value': -1 },
358
- { 'name': 'day', 'src': "aujourd'hui", 'value': 0 },
359
- { 'name': 'day', 'src': 'demain', 'value': 1 },
360
- { 'name': 'sign', 'src': 'il y a', 'value': -1 },
361
- { 'name': 'sign', 'src': "dans|d'ici", 'value': 1 },
362
- { 'name': 'shift', 'src': 'derni:èr|er|ère|ere', 'value': -1 },
363
- { 'name': 'shift', 'src': 'prochain:|e', 'value': 1 }
364
- ],
365
- 'dateParse': [
366
- '{sign} {num} {unit}',
367
- '{sign} {num} {unit}',
368
- '{0?} {unit=5-7} {shift}'
369
- ],
370
- 'timeParse': [
371
- '{0?} {date?} {month} {year?}',
372
- '{0?} {weekday} {shift}'
373
- ]
374
- });
375
-
376
- /*
377
- *
378
- * Date.addLocale(<code>) adds this locale to Sugar.
379
- * To set the locale globally, simply call:
380
- *
381
- * Date.setLocale('it');
382
- *
383
- * var locale = Date.getLocale(<code>) will return this object, which
384
- * can be tweaked to change the behavior of parsing/formatting in the locales.
385
- *
386
- * locale.addFormat adds a date format (see this file for examples).
387
- * Special tokens in the date format will be parsed out into regex tokens:
388
- *
389
- * {0} is a reference to an entry in locale.tokens. Output: (?:the)?
390
- * {unit} is a reference to all units. Output: (day|week|month|...)
391
- * {unit3} is a reference to a specific unit. Output: (hour)
392
- * {unit3-5} is a reference to a subset of the units array. Output: (hour|day|week)
393
- * {unit?} "?" makes that token optional. Output: (day|week|month)?
394
- *
395
- * {day} Any reference to tokens in the modifiers array will include all with the same name. Output: (yesterday|today|tomorrow)
396
- *
397
- * All spaces are optional and will be converted to "\s*"
398
- *
399
- * Locale arrays months, weekdays, units, numbers, as well as the "src" field for
400
- * all entries in the modifiers array follow a special format indicated by a colon:
401
- *
402
- * minute:|s = minute|minutes
403
- * thicke:n|r = thicken|thicker
404
- *
405
- * Additionally in the months, weekdays, units, and numbers array these will be added at indexes that are multiples
406
- * of the relevant number for retrieval. For example having "sunday:|s" in the units array will result in:
407
- *
408
- * units: ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sundays']
409
- *
410
- * When matched, the index will be found using:
411
- *
412
- * units.indexOf(match) % 7;
413
- *
414
- * Resulting in the correct index with any number of alternates for that entry.
415
- *
416
- */
417
-
418
- Date.addLocale('it', {
419
- 'plural': true,
420
- 'months': 'Gennaio,Febbraio,Marzo,Aprile,Maggio,Giugno,Luglio,Agosto,Settembre,Ottobre,Novembre,Dicembre',
421
- 'weekdays': 'Domenica,Luned:ì|i,Marted:ì|i,Mercoled:ì|i,Gioved:ì|i,Venerd:ì|i,Sabato',
422
- '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',
423
- 'numbers': "un:|a|o|',due,tre,quattro,cinque,sei,sette,otto,nove,dieci",
424
- 'tokens': "l'|la|il",
425
- 'short':'{d} {Month} {yyyy}',
426
- 'long': '{d} {Month} {yyyy} {H}:{mm}',
427
- 'full': '{Weekday} {d} {Month} {yyyy} {H}:{mm}:{ss}',
428
- 'past': '{num} {unit} {sign}',
429
- 'future': '{num} {unit} {sign}',
430
- 'duration': '{num} {unit}',
431
- 'timeMarker': 'alle',
432
- 'ampm': 'am,pm',
433
- 'modifiers': [
434
- { 'name': 'day', 'src': 'ieri', 'value': -1 },
435
- { 'name': 'day', 'src': 'oggi', 'value': 0 },
436
- { 'name': 'day', 'src': 'domani', 'value': 1 },
437
- { 'name': 'day', 'src': 'dopodomani', 'value': 2 },
438
- { 'name': 'sign', 'src': 'fa', 'value': -1 },
439
- { 'name': 'sign', 'src': 'da adesso', 'value': 1 },
440
- { 'name': 'shift', 'src': 'scors:o|a', 'value': -1 },
441
- { 'name': 'shift', 'src': 'prossim:o|a', 'value': 1 }
442
- ],
443
- 'dateParse': [
444
- '{num} {unit} {sign}',
445
- '{0?} {unit=5-7} {shift}',
446
- '{0?} {shift} {unit=5-7}'
447
- ],
448
- 'timeParse': [
449
- '{weekday?} {date?} {month} {year?}',
450
- '{shift} {weekday}'
451
- ]
452
- });
453
-
454
- /*
455
- *
456
- * Date.addLocale(<code>) adds this locale to Sugar.
457
- * To set the locale globally, simply call:
458
- *
459
- * Date.setLocale('ja');
460
- *
461
- * var locale = Date.getLocale(<code>) will return this object, which
462
- * can be tweaked to change the behavior of parsing/formatting in the locales.
463
- *
464
- * locale.addFormat adds a date format (see this file for examples).
465
- * Special tokens in the date format will be parsed out into regex tokens:
466
- *
467
- * {0} is a reference to an entry in locale.tokens. Output: (?:the)?
468
- * {unit} is a reference to all units. Output: (day|week|month|...)
469
- * {unit3} is a reference to a specific unit. Output: (hour)
470
- * {unit3-5} is a reference to a subset of the units array. Output: (hour|day|week)
471
- * {unit?} "?" makes that token optional. Output: (day|week|month)?
472
- *
473
- * {day} Any reference to tokens in the modifiers array will include all with the same name. Output: (yesterday|today|tomorrow)
474
- *
475
- * All spaces are optional and will be converted to "\s*"
476
- *
477
- * Locale arrays months, weekdays, units, numbers, as well as the "src" field for
478
- * all entries in the modifiers array follow a special format indicated by a colon:
479
- *
480
- * minute:|s = minute|minutes
481
- * thicke:n|r = thicken|thicker
482
- *
483
- * Additionally in the months, weekdays, units, and numbers array these will be added at indexes that are multiples
484
- * of the relevant number for retrieval. For example having "sunday:|s" in the units array will result in:
485
- *
486
- * units: ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sundays']
487
- *
488
- * When matched, the index will be found using:
489
- *
490
- * units.indexOf(match) % 7;
491
- *
492
- * Resulting in the correct index with any number of alternates for that entry.
493
- *
494
- */
495
-
496
- Date.addLocale('ja', {
497
- 'monthSuffix': '月',
498
- 'weekdays': '日曜日,月曜日,火曜日,水曜日,木曜日,金曜日,土曜日',
499
- 'units': 'ミリ秒,秒,分,時間,日,週間|週,ヶ月|ヵ月|月,年',
500
- 'short': '{yyyy}年{M}月{d}日',
501
- 'long': '{yyyy}年{M}月{d}日 {H}時{mm}分',
502
- 'full': '{yyyy}年{M}月{d}日 {Weekday} {H}時{mm}分{ss}秒',
503
- 'past': '{num}{unit}{sign}',
504
- 'future': '{num}{unit}{sign}',
505
- 'duration': '{num}{unit}',
506
- 'timeSuffixes': '時,分,秒',
507
- 'ampm': '午前,午後',
508
- 'modifiers': [
509
- { 'name': 'day', 'src': '一昨日', 'value': -2 },
510
- { 'name': 'day', 'src': '昨日', 'value': -1 },
511
- { 'name': 'day', 'src': '今日', 'value': 0 },
512
- { 'name': 'day', 'src': '明日', 'value': 1 },
513
- { 'name': 'day', 'src': '明後日', 'value': 2 },
514
- { 'name': 'sign', 'src': '前', 'value': -1 },
515
- { 'name': 'sign', 'src': '後', 'value': 1 },
516
- { 'name': 'shift', 'src': '去|先', 'value': -1 },
517
- { 'name': 'shift', 'src': '来', 'value': 1 }
518
- ],
519
- 'dateParse': [
520
- '{num}{unit}{sign}'
521
- ],
522
- 'timeParse': [
523
- '{shift}{unit=5-7}{weekday?}',
524
- '{year}年{month?}月?{date?}日?',
525
- '{month}月{date?}日?',
526
- '{date}日'
527
- ]
528
- });
529
-
530
- /*
531
- *
532
- * Date.addLocale(<code>) adds this locale to Sugar.
533
- * To set the locale globally, simply call:
534
- *
535
- * Date.setLocale('ko');
536
- *
537
- * var locale = Date.getLocale(<code>) will return this object, which
538
- * can be tweaked to change the behavior of parsing/formatting in the locales.
539
- *
540
- * locale.addFormat adds a date format (see this file for examples).
541
- * Special tokens in the date format will be parsed out into regex tokens:
542
- *
543
- * {0} is a reference to an entry in locale.tokens. Output: (?:the)?
544
- * {unit} is a reference to all units. Output: (day|week|month|...)
545
- * {unit3} is a reference to a specific unit. Output: (hour)
546
- * {unit3-5} is a reference to a subset of the units array. Output: (hour|day|week)
547
- * {unit?} "?" makes that token optional. Output: (day|week|month)?
548
- *
549
- * {day} Any reference to tokens in the modifiers array will include all with the same name. Output: (yesterday|today|tomorrow)
550
- *
551
- * All spaces are optional and will be converted to "\s*"
552
- *
553
- * Locale arrays months, weekdays, units, numbers, as well as the "src" field for
554
- * all entries in the modifiers array follow a special format indicated by a colon:
555
- *
556
- * minute:|s = minute|minutes
557
- * thicke:n|r = thicken|thicker
558
- *
559
- * Additionally in the months, weekdays, units, and numbers array these will be added at indexes that are multiples
560
- * of the relevant number for retrieval. For example having "sunday:|s" in the units array will result in:
561
- *
562
- * units: ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sundays']
563
- *
564
- * When matched, the index will be found using:
565
- *
566
- * units.indexOf(match) % 7;
567
- *
568
- * Resulting in the correct index with any number of alternates for that entry.
569
- *
570
- */
571
-
572
- Date.addLocale('ko', {
573
- 'digitDate': true,
574
- 'monthSuffix': '월',
575
- 'weekdays': '일요일,월요일,화요일,수요일,목요일,금요일,토요일',
576
- 'units': '밀리초,초,분,시간,일,주,개월|달,년',
577
- 'numbers': '일|한,이,삼,사,오,육,칠,팔,구,십',
578
- 'short': '{yyyy}년{M}월{d}일',
579
- 'long': '{yyyy}년{M}월{d}일 {H}시{mm}분',
580
- 'full': '{yyyy}년{M}월{d}일 {Weekday} {H}시{mm}분{ss}초',
581
- 'past': '{num}{unit} {sign}',
582
- 'future': '{num}{unit} {sign}',
583
- 'duration': '{num}{unit}',
584
- 'timeSuffixes': '시,분,초',
585
- 'ampm': '오전,오후',
586
- 'modifiers': [
587
- { 'name': 'day', 'src': '그저께', 'value': -2 },
588
- { 'name': 'day', 'src': '어제', 'value': -1 },
589
- { 'name': 'day', 'src': '오늘', 'value': 0 },
590
- { 'name': 'day', 'src': '내일', 'value': 1 },
591
- { 'name': 'day', 'src': '모레', 'value': 2 },
592
- { 'name': 'sign', 'src': '전', 'value': -1 },
593
- { 'name': 'sign', 'src': '후', 'value': 1 },
594
- { 'name': 'shift', 'src': '지난|작', 'value': -1 },
595
- { 'name': 'shift', 'src': '이번', 'value': 0 },
596
- { 'name': 'shift', 'src': '다음|내', 'value': 1 }
597
- ],
598
- 'dateParse': [
599
- '{num}{unit} {sign}',
600
- '{shift?} {unit=5-7}'
601
- ],
602
- 'timeParse': [
603
- '{shift} {unit=5?} {weekday}',
604
- '{year}년{month?}월?{date?}일?',
605
- '{month}월{date?}일?',
606
- '{date}일'
607
- ]
608
- });
609
-
610
- /*
611
- *
612
- * Date.addLocale(<code>) adds this locale to Sugar.
613
- * To set the locale globally, simply call:
614
- *
615
- * Date.setLocale('nl');
616
- *
617
- * var locale = Date.getLocale(<code>) will return this object, which
618
- * can be tweaked to change the behavior of parsing/formatting in the locales.
619
- *
620
- * locale.addFormat adds a date format (see this file for examples).
621
- * Special tokens in the date format will be parsed out into regex tokens:
622
- *
623
- * {0} is a reference to an entry in locale.tokens. Output: (?:the)?
624
- * {unit} is a reference to all units. Output: (day|week|month|...)
625
- * {unit3} is a reference to a specific unit. Output: (hour)
626
- * {unit3-5} is a reference to a subset of the units array. Output: (hour|day|week)
627
- * {unit?} "?" makes that token optional. Output: (day|week|month)?
628
- *
629
- * {day} Any reference to tokens in the modifiers array will include all with the same name. Output: (yesterday|today|tomorrow)
630
- *
631
- * All spaces are optional and will be converted to "\s*"
632
- *
633
- * Locale arrays months, weekdays, units, numbers, as well as the "src" field for
634
- * all entries in the modifiers array follow a special format indicated by a colon:
635
- *
636
- * minute:|s = minute|minutes
637
- * thicke:n|r = thicken|thicker
638
- *
639
- * Additionally in the months, weekdays, units, and numbers array these will be added at indexes that are multiples
640
- * of the relevant number for retrieval. For example having "sunday:|s" in the units array will result in:
641
- *
642
- * units: ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sundays']
643
- *
644
- * When matched, the index will be found using:
645
- *
646
- * units.indexOf(match) % 7;
647
- *
648
- * Resulting in the correct index with any number of alternates for that entry.
649
- *
650
- */
651
-
652
- Date.addLocale('nl', {
653
- 'plural': true,
654
- 'months': 'januari,februari,maart,april,mei,juni,juli,augustus,september,oktober,november,december',
655
- 'weekdays': 'zondag|zo,maandag|ma,dinsdag|di,woensdag|woe|wo,donderdag|do,vrijdag|vrij|vr,zaterdag|za',
656
- 'units': 'milliseconde:|n,seconde:|n,minu:ut|ten,uur,dag:|en,we:ek|ken,maand:|en,jaar',
657
- 'numbers': 'een,twee,drie,vier,vijf,zes,zeven,acht,negen',
658
- 'tokens': '',
659
- 'short':'{d} {Month} {yyyy}',
660
- 'long': '{d} {Month} {yyyy} {H}:{mm}',
661
- 'full': '{Weekday} {d} {Month} {yyyy} {H}:{mm}:{ss}',
662
- 'past': '{num} {unit} {sign}',
663
- 'future': '{num} {unit} {sign}',
664
- 'duration': '{num} {unit}',
665
- 'timeMarker': "'s|om",
666
- 'modifiers': [
667
- { 'name': 'day', 'src': 'gisteren', 'value': -1 },
668
- { 'name': 'day', 'src': 'vandaag', 'value': 0 },
669
- { 'name': 'day', 'src': 'morgen', 'value': 1 },
670
- { 'name': 'day', 'src': 'overmorgen', 'value': 2 },
671
- { 'name': 'sign', 'src': 'geleden', 'value': -1 },
672
- { 'name': 'sign', 'src': 'vanaf nu', 'value': 1 },
673
- { 'name': 'shift', 'src': 'laatste|vorige|afgelopen', 'value': -1 },
674
- { 'name': 'shift', 'src': 'volgend:|e', 'value': 1 }
675
- ],
676
- 'dateParse': [
677
- '{num} {unit} {sign}',
678
- '{0?} {unit=5-7} {shift}',
679
- '{0?} {shift} {unit=5-7}'
680
- ],
681
- 'timeParse': [
682
- '{weekday?} {date?} {month} {year?}',
683
- '{shift} {weekday}'
684
- ]
685
- });
686
- /*
687
- *
688
- * Date.addLocale(<code>) adds this locale to Sugar.
689
- * To set the locale globally, simply call:
690
- *
691
- * Date.setLocale('pl');
692
- *
693
- * var locale = Date.getLocale(<code>) will return this object, which
694
- * can be tweaked to change the behavior of parsing/formatting in the locales.
695
- *
696
- * locale.addFormat adds a date format (see this file for examples).
697
- * Special tokens in the date format will be parsed out into regex tokens:
698
- *
699
- * {0} is a reference to an entry in locale.optionals. Output: (?:the)?
700
- * {unit} is a reference to all units. Output: (day|week|month|...)
701
- * {unit3} is a reference to a specific unit. Output: (hour)
702
- * {unit3-5} is a reference to a subset of the units array. Output: (hour|day|week)
703
- * {unit?} "?" makes that token optional. Output: (day|week|month)?
704
- *
705
- * {day} Any reference to tokens in the modifiers array will include all with the same name. Output: (yesterday|today|tomorrow)
706
- *
707
- * All spaces are optional and will be converted to "\s*"
708
- *
709
- * Locale arrays months, weekdays, units, numbers, as well as the "src" field for
710
- * all entries in the modifiers array follow a special format indicated by a colon:
711
- *
712
- * minute:|s = minute|minutes
713
- * thicke:n|r = thicken|thicker
714
- *
715
- * Additionally in the months, weekdays, units, and numbers array these will be added at indexes that are multiples
716
- * of the relevant number for retrieval. For example having "sunday:|s" in the units array will result in:
717
- *
718
- * units: ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sundays']
719
- *
720
- * When matched, the index will be found using:
721
- *
722
- * units.indexOf(match) % 7;
723
- *
724
- * Resulting in the correct index with any number of alternates for that entry.
725
- *
726
- */
727
-
728
- Date.addLocale('pl', {
729
- 'plural': true,
730
- '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',
731
- 'weekdays': 'Niedziela|Niedzielę,Poniedziałek,Wtorek,Środ:a|ę,Czwartek,Piątek,Sobota|Sobotę',
732
- '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',
733
- 'numbers': 'jeden|jedną,dwa|dwie,trzy,cztery,pięć,sześć,siedem,osiem,dziewięć,dziesięć',
734
- 'optionals': 'w|we,roku',
735
- 'short': '{d} {Month} {yyyy}',
736
- 'long': '{d} {Month} {yyyy} {H}:{mm}',
737
- 'full' : '{Weekday}, {d} {Month} {yyyy} {H}:{mm}:{ss}',
738
- 'past': '{num} {unit} {sign}',
739
- 'future': '{sign} {num} {unit}',
740
- 'duration': '{num} {unit}',
741
- 'timeMarker':'o',
742
- 'ampm': 'am,pm',
743
- 'modifiers': [
744
- { 'name': 'day', 'src': 'przedwczoraj', 'value': -2 },
745
- { 'name': 'day', 'src': 'wczoraj', 'value': -1 },
746
- { 'name': 'day', 'src': 'dzisiaj|dziś', 'value': 0 },
747
- { 'name': 'day', 'src': 'jutro', 'value': 1 },
748
- { 'name': 'day', 'src': 'pojutrze', 'value': 2 },
749
- { 'name': 'sign', 'src': 'temu|przed', 'value': -1 },
750
- { 'name': 'sign', 'src': 'za', 'value': 1 },
751
- { 'name': 'shift', 'src': 'zeszły|zeszła|ostatni|ostatnia', 'value': -1 },
752
- { 'name': 'shift', 'src': 'następny|następna|następnego|przyszły|przyszła|przyszłego', 'value': 1 }
753
- ],
754
- 'dateParse': [
755
- '{num} {unit} {sign}',
756
- '{sign} {num} {unit}',
757
- '{month} {year}',
758
- '{shift} {unit=5-7}',
759
- '{0} {shift?} {weekday}'
760
- ],
761
- 'timeParse': [
762
- '{date} {month} {year?} {1}',
763
- '{0} {shift?} {weekday}'
764
- ]
765
- });
766
-
767
- /*
768
- *
769
- * Date.addLocale(<code>) adds this locale to Sugar.
770
- * To set the locale globally, simply call:
771
- *
772
- * Date.setLocale('pt');
773
- *
774
- * var locale = Date.getLocale(<code>) will return this object, which
775
- * can be tweaked to change the behavior of parsing/formatting in the locales.
776
- *
777
- * locale.addFormat adds a date format (see this file for examples).
778
- * Special tokens in the date format will be parsed out into regex tokens:
779
- *
780
- * {0} is a reference to an entry in locale.tokens. Output: (?:the)?
781
- * {unit} is a reference to all units. Output: (day|week|month|...)
782
- * {unit3} is a reference to a specific unit. Output: (hour)
783
- * {unit3-5} is a reference to a subset of the units array. Output: (hour|day|week)
784
- * {unit?} "?" makes that token optional. Output: (day|week|month)?
785
- *
786
- * {day} Any reference to tokens in the modifiers array will include all with the same name. Output: (yesterday|today|tomorrow)
787
- *
788
- * All spaces are optional and will be converted to "\s*"
789
- *
790
- * Locale arrays months, weekdays, units, numbers, as well as the "src" field for
791
- * all entries in the modifiers array follow a special format indicated by a colon:
792
- *
793
- * minute:|s = minute|minutes
794
- * thicke:n|r = thicken|thicker
795
- *
796
- * Additionally in the months, weekdays, units, and numbers array these will be added at indexes that are multiples
797
- * of the relevant number for retrieval. For example having "sunday:|s" in the units array will result in:
798
- *
799
- * units: ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sundays']
800
- *
801
- * When matched, the index will be found using:
802
- *
803
- * units.indexOf(match) % 7;
804
- *
805
- * Resulting in the correct index with any number of alternates for that entry.
806
- *
807
- */
808
-
809
- Date.addLocale('pt', {
810
- 'plural': true,
811
- 'months': 'janeiro,fevereiro,março,abril,maio,junho,julho,agosto,setembro,outubro,novembro,dezembro',
812
- 'weekdays': 'domingo,segunda-feira,terça-feira,quarta-feira,quinta-feira,sexta-feira,sábado|sabado',
813
- 'units': 'milisegundo:|s,segundo:|s,minuto:|s,hora:|s,dia:|s,semana:|s,mês|mêses|mes|meses,ano:|s',
814
- 'numbers': 'um,dois,três|tres,quatro,cinco,seis,sete,oito,nove,dez,uma,duas',
815
- 'tokens': 'a,de',
816
- 'short':'{d} de {month} de {yyyy}',
817
- 'long': '{d} de {month} de {yyyy} {H}:{mm}',
818
- 'full': '{Weekday}, {d} de {month} de {yyyy} {H}:{mm}:{ss}',
819
- 'past': '{num} {unit} {sign}',
820
- 'future': '{sign} {num} {unit}',
821
- 'duration': '{num} {unit}',
822
- 'timeMarker': 'às',
823
- 'ampm': 'am,pm',
824
- 'modifiers': [
825
- { 'name': 'day', 'src': 'anteontem', 'value': -2 },
826
- { 'name': 'day', 'src': 'ontem', 'value': -1 },
827
- { 'name': 'day', 'src': 'hoje', 'value': 0 },
828
- { 'name': 'day', 'src': 'amanh:ã|a', 'value': 1 },
829
- { 'name': 'sign', 'src': 'atrás|atras|há|ha', 'value': -1 },
830
- { 'name': 'sign', 'src': 'daqui a', 'value': 1 },
831
- { 'name': 'shift', 'src': 'passad:o|a', 'value': -1 },
832
- { 'name': 'shift', 'src': 'próximo|próxima|proximo|proxima', 'value': 1 }
833
- ],
834
- 'dateParse': [
835
- '{num} {unit} {sign}',
836
- '{sign} {num} {unit}',
837
- '{0?} {unit=5-7} {shift}',
838
- '{0?} {shift} {unit=5-7}'
839
- ],
840
- 'timeParse': [
841
- '{date?} {1?} {month} {1?} {year?}',
842
- '{0?} {shift} {weekday}'
843
- ]
844
- });
845
-
846
- /*
847
- *
848
- * Date.addLocale(<code>) adds this locale to Sugar.
849
- * To set the locale globally, simply call:
850
- *
851
- * Date.setLocale('ru');
852
- *
853
- * var locale = Date.getLocale(<code>) will return this object, which
854
- * can be tweaked to change the behavior of parsing/formatting in the locales.
855
- *
856
- * locale.addFormat adds a date format (see this file for examples).
857
- * Special tokens in the date format will be parsed out into regex tokens:
858
- *
859
- * {0} is a reference to an entry in locale.tokens. Output: (?:the)?
860
- * {unit} is a reference to all units. Output: (day|week|month|...)
861
- * {unit3} is a reference to a specific unit. Output: (hour)
862
- * {unit3-5} is a reference to a subset of the units array. Output: (hour|day|week)
863
- * {unit?} "?" makes that token optional. Output: (day|week|month)?
864
- *
865
- * {day} Any reference to tokens in the modifiers array will include all with the same name. Output: (yesterday|today|tomorrow)
866
- *
867
- * All spaces are optional and will be converted to "\s*"
868
- *
869
- * Locale arrays months, weekdays, units, numbers, as well as the "src" field for
870
- * all entries in the modifiers array follow a special format indicated by a colon:
871
- *
872
- * minute:|s = minute|minutes
873
- * thicke:n|r = thicken|thicker
874
- *
875
- * Additionally in the months, weekdays, units, and numbers array these will be added at indexes that are multiples
876
- * of the relevant number for retrieval. For example having "sunday:|s" in the units array will result in:
877
- *
878
- * units: ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sundays']
879
- *
880
- * When matched, the index will be found using:
881
- *
882
- * units.indexOf(match) % 7;
883
- *
884
- * Resulting in the correct index with any number of alternates for that entry.
885
- *
886
- */
887
-
888
- Date.addLocale('ru', {
889
- 'months': 'Январ:я|ь,Феврал:я|ь,Март:а|,Апрел:я|ь,Ма:я|й,Июн:я|ь,Июл:я|ь,Август:а|,Сентябр:я|ь,Октябр:я|ь,Ноябр:я|ь,Декабр:я|ь',
890
- 'weekdays': 'Воскресенье,Понедельник,Вторник,Среда,Четверг,Пятница,Суббота',
891
- 'units': 'миллисекунд:а|у|ы|,секунд:а|у|ы|,минут:а|у|ы|,час:||а|ов,день|день|дня|дней,недел:я|ю|и|ь|е,месяц:||а|ев|е,год|год|года|лет|году',
892
- 'numbers': 'од:ин|ну,дв:а|е,три,четыре,пять,шесть,семь,восемь,девять,десять',
893
- 'tokens': 'в|на,года',
894
- 'short':'{d} {month} {yyyy} года',
895
- 'long': '{d} {month} {yyyy} года {H}:{mm}',
896
- 'full': '{Weekday} {d} {month} {yyyy} года {H}:{mm}:{ss}',
897
- 'relative': function(num, unit, ms, format) {
898
- var numberWithUnit, last = num.toString().slice(-1);
899
- switch(true) {
900
- case num >= 11 && num <= 15: mult = 3; break;
901
- case last == 1: mult = 1; break;
902
- case last >= 2 && last <= 4: mult = 2; break;
903
- default: mult = 3;
904
- }
905
- numberWithUnit = num + ' ' + this['units'][(mult * 8) + unit];
906
- switch(format) {
907
- case 'duration': return numberWithUnit;
908
- case 'past': return numberWithUnit + ' назад';
909
- case 'future': return 'через ' + numberWithUnit;
910
- }
911
- },
912
- 'timeMarker': 'в',
913
- 'ampm': ' утра, вечера',
914
- 'modifiers': [
915
- { 'name': 'day', 'src': 'позавчера', 'value': -2 },
916
- { 'name': 'day', 'src': 'вчера', 'value': -1 },
917
- { 'name': 'day', 'src': 'сегодня', 'value': 0 },
918
- { 'name': 'day', 'src': 'завтра', 'value': 1 },
919
- { 'name': 'day', 'src': 'послезавтра', 'value': 2 },
920
- { 'name': 'sign', 'src': 'назад', 'value': -1 },
921
- { 'name': 'sign', 'src': 'через', 'value': 1 },
922
- { 'name': 'shift', 'src': 'прошл:ый|ой|ом', 'value': -1 },
923
- { 'name': 'shift', 'src': 'следующ:ий|ей|ем', 'value': 1 }
924
- ],
925
- 'dateParse': [
926
- '{num} {unit} {sign}',
927
- '{sign} {num} {unit}',
928
- '{month} {year}',
929
- '{0?} {shift} {unit=5-7}'
930
- ],
931
- 'timeParse': [
932
- '{date} {month} {year?} {1?}',
933
- '{0?} {shift} {weekday}'
934
- ]
935
- });
936
-
937
- /*
938
- *
939
- * Date.addLocale(<code>) adds this locale to Sugar.
940
- * To set the locale globally, simply call:
941
- *
942
- * Date.setLocale('sv');
943
- *
944
- * var locale = Date.getLocale(<code>) will return this object, which
945
- * can be tweaked to change the behavior of parsing/formatting in the locales.
946
- *
947
- * locale.addFormat adds a date format (see this file for examples).
948
- * Special tokens in the date format will be parsed out into regex tokens:
949
- *
950
- * {0} is a reference to an entry in locale.tokens. Output: (?:the)?
951
- * {unit} is a reference to all units. Output: (day|week|month|...)
952
- * {unit3} is a reference to a specific unit. Output: (hour)
953
- * {unit3-5} is a reference to a subset of the units array. Output: (hour|day|week)
954
- * {unit?} "?" makes that token optional. Output: (day|week|month)?
955
- *
956
- * {day} Any reference to tokens in the modifiers array will include all with the same name. Output: (yesterday|today|tomorrow)
957
- *
958
- * All spaces are optional and will be converted to "\s*"
959
- *
960
- * Locale arrays months, weekdays, units, numbers, as well as the "src" field for
961
- * all entries in the modifiers array follow a special format indicated by a colon:
962
- *
963
- * minute:|s = minute|minutes
964
- * thicke:n|r = thicken|thicker
965
- *
966
- * Additionally in the months, weekdays, units, and numbers array these will be added at indexes that are multiples
967
- * of the relevant number for retrieval. For example having "sunday:|s" in the units array will result in:
968
- *
969
- * units: ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sundays']
970
- *
971
- * When matched, the index will be found using:
972
- *
973
- * units.indexOf(match) % 7;
974
- *
975
- * Resulting in the correct index with any number of alternates for that entry.
976
- *
977
- */
978
-
979
- Date.addLocale('sv', {
980
- 'plural': true,
981
- 'months': 'januari,februari,mars,april,maj,juni,juli,augusti,september,oktober,november,december',
982
- 'weekdays': 'söndag|sondag,måndag:|en+mandag:|en,tisdag,onsdag,torsdag,fredag,lördag|lordag',
983
- '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',
984
- 'numbers': 'en|ett,två|tva,tre,fyra,fem,sex,sju,åtta|atta,nio,tio',
985
- 'tokens': 'den,för|for',
986
- 'articles': 'den',
987
- 'short':'den {d} {month} {yyyy}',
988
- 'long': 'den {d} {month} {yyyy} {H}:{mm}',
989
- 'full': '{Weekday} den {d} {month} {yyyy} {H}:{mm}:{ss}',
990
- 'past': '{num} {unit} {sign}',
991
- 'future': '{sign} {num} {unit}',
992
- 'duration': '{num} {unit}',
993
- 'ampm': 'am,pm',
994
- 'modifiers': [
995
- { 'name': 'day', 'src': 'förrgår|i förrgår|iförrgår|forrgar|i forrgar|iforrgar', 'value': -2 },
996
- { 'name': 'day', 'src': 'går|i går|igår|gar|i gar|igar', 'value': -1 },
997
- { 'name': 'day', 'src': 'dag|i dag|idag', 'value': 0 },
998
- { 'name': 'day', 'src': 'morgon|i morgon|imorgon', 'value': 1 },
999
- { 'name': 'day', 'src': 'över morgon|övermorgon|i över morgon|i övermorgon|iövermorgon|over morgon|overmorgon|i over morgon|i overmorgon|iovermorgon', 'value': 2 },
1000
- { 'name': 'sign', 'src': 'sedan|sen', 'value': -1 },
1001
- { 'name': 'sign', 'src': 'om', 'value': 1 },
1002
- { 'name': 'shift', 'src': 'i förra|förra|i forra|forra', 'value': -1 },
1003
- { 'name': 'shift', 'src': 'denna', 'value': 0 },
1004
- { 'name': 'shift', 'src': 'nästa|nasta', 'value': 1 }
1005
- ],
1006
- 'dateParse': [
1007
- '{num} {unit} {sign}',
1008
- '{sign} {num} {unit}',
1009
- '{1?} {num} {unit} {sign}',
1010
- '{shift} {unit=5-7}'
1011
- ],
1012
- 'timeParse': [
1013
- '{0?} {weekday?} {date?} {month} {year}',
1014
- '{date} {month}',
1015
- '{shift} {weekday}'
1016
- ]
1017
- });
1018
-
1019
- /*
1020
- *
1021
- * Date.addLocale(<code>) adds this locale to Sugar.
1022
- * To set the locale globally, simply call:
1023
- *
1024
- * Date.setLocale('zh-CN');
1025
- *
1026
- * var locale = Date.getLocale(<code>) will return this object, which
1027
- * can be tweaked to change the behavior of parsing/formatting in the locales.
1028
- *
1029
- * locale.addFormat adds a date format (see this file for examples).
1030
- * Special tokens in the date format will be parsed out into regex tokens:
1031
- *
1032
- * {0} is a reference to an entry in locale.tokens. Output: (?:the)?
1033
- * {unit} is a reference to all units. Output: (day|week|month|...)
1034
- * {unit3} is a reference to a specific unit. Output: (hour)
1035
- * {unit3-5} is a reference to a subset of the units array. Output: (hour|day|week)
1036
- * {unit?} "?" makes that token optional. Output: (day|week|month)?
1037
- *
1038
- * {day} Any reference to tokens in the modifiers array will include all with the same name. Output: (yesterday|today|tomorrow)
1039
- *
1040
- * All spaces are optional and will be converted to "\s*"
1041
- *
1042
- * Locale arrays months, weekdays, units, numbers, as well as the "src" field for
1043
- * all entries in the modifiers array follow a special format indicated by a colon:
1044
- *
1045
- * minute:|s = minute|minutes
1046
- * thicke:n|r = thicken|thicker
1047
- *
1048
- * Additionally in the months, weekdays, units, and numbers array these will be added at indexes that are multiples
1049
- * of the relevant number for retrieval. For example having "sunday:|s" in the units array will result in:
1050
- *
1051
- * units: ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sundays']
1052
- *
1053
- * When matched, the index will be found using:
1054
- *
1055
- * units.indexOf(match) % 7;
1056
- *
1057
- * Resulting in the correct index with any number of alternates for that entry.
1058
- *
1059
- */
1060
-
1061
- Date.addLocale('zh-CN', {
1062
- 'variant': true,
1063
- 'monthSuffix': '月',
1064
- 'weekdays': '星期日|周日,星期一|周一,星期二|周二,星期三|周三,星期四|周四,星期五|周五,星期六|周六',
1065
- 'units': '毫秒,秒钟,分钟,小时,天,个星期|周,个月,年',
1066
- 'tokens': '日|号',
1067
- 'short':'{yyyy}年{M}月{d}日',
1068
- 'long': '{yyyy}年{M}月{d}日 {tt}{h}:{mm}',
1069
- 'full': '{yyyy}年{M}月{d}日 {weekday} {tt}{h}:{mm}:{ss}',
1070
- 'past': '{num}{unit}{sign}',
1071
- 'future': '{num}{unit}{sign}',
1072
- 'duration': '{num}{unit}',
1073
- 'timeSuffixes': '点|时,分钟?,秒',
1074
- 'ampm': '上午,下午',
1075
- 'modifiers': [
1076
- { 'name': 'day', 'src': '前天', 'value': -2 },
1077
- { 'name': 'day', 'src': '昨天', 'value': -1 },
1078
- { 'name': 'day', 'src': '今天', 'value': 0 },
1079
- { 'name': 'day', 'src': '明天', 'value': 1 },
1080
- { 'name': 'day', 'src': '后天', 'value': 2 },
1081
- { 'name': 'sign', 'src': '前', 'value': -1 },
1082
- { 'name': 'sign', 'src': '后', 'value': 1 },
1083
- { 'name': 'shift', 'src': '上|去', 'value': -1 },
1084
- { 'name': 'shift', 'src': '这', 'value': 0 },
1085
- { 'name': 'shift', 'src': '下|明', 'value': 1 }
1086
- ],
1087
- 'dateParse': [
1088
- '{num}{unit}{sign}',
1089
- '{shift}{unit=5-7}'
1090
- ],
1091
- 'timeParse': [
1092
- '{shift}{weekday}',
1093
- '{year}年{month?}月?{date?}{0?}',
1094
- '{month}月{date?}{0?}',
1095
- '{date}[日号]'
1096
- ]
1097
- });
1098
-
1099
- /*
1100
- *
1101
- * Date.addLocale(<code>) adds this locale to Sugar.
1102
- * To set the locale globally, simply call:
1103
- *
1104
- * Date.setLocale('zh-TW');
1105
- *
1106
- * var locale = Date.getLocale(<code>) will return this object, which
1107
- * can be tweaked to change the behavior of parsing/formatting in the locales.
1108
- *
1109
- * locale.addFormat adds a date format (see this file for examples).
1110
- * Special tokens in the date format will be parsed out into regex tokens:
1111
- *
1112
- * {0} is a reference to an entry in locale.tokens. Output: (?:the)?
1113
- * {unit} is a reference to all units. Output: (day|week|month|...)
1114
- * {unit3} is a reference to a specific unit. Output: (hour)
1115
- * {unit3-5} is a reference to a subset of the units array. Output: (hour|day|week)
1116
- * {unit?} "?" makes that token optional. Output: (day|week|month)?
1117
- *
1118
- * {day} Any reference to tokens in the modifiers array will include all with the same name. Output: (yesterday|today|tomorrow)
1119
- *
1120
- * All spaces are optional and will be converted to "\s*"
1121
- *
1122
- * Locale arrays months, weekdays, units, numbers, as well as the "src" field for
1123
- * all entries in the modifiers array follow a special format indicated by a colon:
1124
- *
1125
- * minute:|s = minute|minutes
1126
- * thicke:n|r = thicken|thicker
1127
- *
1128
- * Additionally in the months, weekdays, units, and numbers array these will be added at indexes that are multiples
1129
- * of the relevant number for retrieval. For example having "sunday:|s" in the units array will result in:
1130
- *
1131
- * units: ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sundays']
1132
- *
1133
- * When matched, the index will be found using:
1134
- *
1135
- * units.indexOf(match) % 7;
1136
- *
1137
- * Resulting in the correct index with any number of alternates for that entry.
1138
- *
1139
- */
1140
-
1141
- //'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};前天,昨天,今天,明天,後天;,前,,後;,上|去,這,下|明',
1142
-
1143
- Date.addLocale('zh-TW', {
1144
- 'monthSuffix': '月',
1145
- 'weekdays': '星期日|週日,星期一|週一,星期二|週二,星期三|週三,星期四|週四,星期五|週五,星期六|週六',
1146
- 'units': '毫秒,秒鐘,分鐘,小時,天,個星期|週,個月,年',
1147
- 'tokens': '日|號',
1148
- 'short':'{yyyy}年{M}月{d}日',
1149
- 'long': '{yyyy}年{M}月{d}日 {tt}{h}:{mm}',
1150
- 'full': '{yyyy}年{M}月{d}日 {Weekday} {tt}{h}:{mm}:{ss}',
1151
- 'past': '{num}{unit}{sign}',
1152
- 'future': '{num}{unit}{sign}',
1153
- 'duration': '{num}{unit}',
1154
- 'timeSuffixes': '點|時,分鐘?,秒',
1155
- 'ampm': '上午,下午',
1156
- 'modifiers': [
1157
- { 'name': 'day', 'src': '前天', 'value': -2 },
1158
- { 'name': 'day', 'src': '昨天', 'value': -1 },
1159
- { 'name': 'day', 'src': '今天', 'value': 0 },
1160
- { 'name': 'day', 'src': '明天', 'value': 1 },
1161
- { 'name': 'day', 'src': '後天', 'value': 2 },
1162
- { 'name': 'sign', 'src': '前', 'value': -1 },
1163
- { 'name': 'sign', 'src': '後', 'value': 1 },
1164
- { 'name': 'shift', 'src': '上|去', 'value': -1 },
1165
- { 'name': 'shift', 'src': '這', 'value': 0 },
1166
- { 'name': 'shift', 'src': '下|明', 'value': 1 }
1167
- ],
1168
- 'dateParse': [
1169
- '{num}{unit}{sign}',
1170
- '{shift}{unit=5-7}'
1171
- ],
1172
- 'timeParse': [
1173
- '{shift}{weekday}',
1174
- '{year}年{month?}月?{date?}{0?}',
1175
- '{month}月{date?}{0?}',
1176
- '{date}[日號]'
1177
- ]
1178
- });
1179
-