momentjs-rails 2.4.0 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,7 @@
1
1
  // moment.js language configuration
2
2
  // language : estonian (et)
3
3
  // author : Henry Kehlmann : https://github.com/madhenry
4
+ // improvements : Illimar Tambek : https://github.com/ragulka
4
5
 
5
6
  (function (factory) {
6
7
  if (typeof define === 'function' && define.amd) {
@@ -11,8 +12,23 @@
11
12
  factory(window.moment); // Browser global
12
13
  }
13
14
  }(function (moment) {
14
- function translateSeconds(number, withoutSuffix, key, isFuture) {
15
- return (isFuture || withoutSuffix) ? 'paari sekundi' : 'paar sekundit';
15
+ function processRelativeTime(number, withoutSuffix, key, isFuture) {
16
+ var format = {
17
+ 's' : ['mõne sekundi', 'mõni sekund', 'paar sekundit'],
18
+ 'm' : ['ühe minuti', 'üks minut'],
19
+ 'mm': [number + ' minuti', number + ' minutit'],
20
+ 'h' : ['ühe tunni', 'tund aega', 'üks tund'],
21
+ 'hh': [number + ' tunni', number + ' tundi'],
22
+ 'd' : ['ühe päeva', 'üks päev'],
23
+ 'M' : ['kuu aja', 'kuu aega', 'üks kuu'],
24
+ 'MM': [number + ' kuu', number + ' kuud'],
25
+ 'y' : ['ühe aasta', 'aasta', 'üks aasta'],
26
+ 'yy': [number + ' aasta', number + ' aastat']
27
+ };
28
+ if (withoutSuffix) {
29
+ return format[key][2] ? format[key][2] : format[key][1];
30
+ }
31
+ return isFuture ? format[key][0] : format[key][1];
16
32
  }
17
33
 
18
34
  return moment.lang('et', {
@@ -39,17 +55,17 @@
39
55
  relativeTime : {
40
56
  future : "%s pärast",
41
57
  past : "%s tagasi",
42
- s : translateSeconds,
43
- m : "minut",
44
- mm : "%d minutit",
45
- h : "tund",
46
- hh : "%d tundi",
47
- d : "päev",
48
- dd : "%d päeva",
49
- M : "kuu",
50
- MM : "%d kuud",
51
- y : "aasta",
52
- yy : "%d aastat"
58
+ s : processRelativeTime,
59
+ m : processRelativeTime,
60
+ mm : processRelativeTime,
61
+ h : processRelativeTime,
62
+ hh : processRelativeTime,
63
+ d : processRelativeTime,
64
+ dd : '%d päeva',
65
+ M : processRelativeTime,
66
+ MM : processRelativeTime,
67
+ y : processRelativeTime,
68
+ yy : processRelativeTime
53
69
  },
54
70
  ordinal : '%d.',
55
71
  week : {
@@ -38,7 +38,7 @@
38
38
  return ((/^[0-9].+$/).test(s) ? "tra" : "in") + " " + s;
39
39
  },
40
40
  past : "%s fa",
41
- s : "secondi",
41
+ s : "alcuni secondi",
42
42
  m : "un minuto",
43
43
  mm : "%d minuti",
44
44
  h : "un'ora",
@@ -1,7 +1,10 @@
1
1
  // moment.js language configuration
2
2
  // language : korean (ko)
3
- // author : Kyungwook, Park : https://github.com/kyungw00k
4
-
3
+ //
4
+ // authors
5
+ //
6
+ // - Kyungwook, Park : https://github.com/kyungw00k
7
+ // - Jeeeyul Lee <jeeeyul@gmail.com>
5
8
  (function (factory) {
6
9
  if (typeof define === 'function' && define.amd) {
7
10
  define(['moment'], factory); // AMD
@@ -51,6 +54,10 @@
51
54
  y : "일년",
52
55
  yy : "%d년"
53
56
  },
54
- ordinal : '%d일'
57
+ ordinal : '%d일',
58
+ meridiemParse : /(오전|오후)/,
59
+ isPM : function (token) {
60
+ return token === "오후";
61
+ }
55
62
  });
56
63
  }));
@@ -0,0 +1,160 @@
1
+ // moment.js language configuration
2
+ // language : Luxembourgish (lb)
3
+ // author : mweimerskirch : https://github.com/mweimerskirch
4
+
5
+ // Note: Luxembourgish has a very particular phonological rule ("Eifeler Regel") that causes the
6
+ // deletion of the final "n" in certain contexts. That's what the "eifelerRegelAppliesToWeekday"
7
+ // and "eifelerRegelAppliesToNumber" methods are meant for
8
+
9
+ (function (factory) {
10
+ if (typeof define === 'function' && define.amd) {
11
+ define(['moment'], factory); // AMD
12
+ } else if (typeof exports === 'object') {
13
+ module.exports = factory(require('../moment')); // Node
14
+ } else {
15
+ factory(window.moment); // Browser global
16
+ }
17
+ }(function (moment) {
18
+ function processRelativeTime(number, withoutSuffix, key, isFuture) {
19
+ var format = {
20
+ 'm': ['eng Minutt', 'enger Minutt'],
21
+ 'h': ['eng Stonn', 'enger Stonn'],
22
+ 'd': ['een Dag', 'engem Dag'],
23
+ 'dd': [number + ' Deeg', number + ' Deeg'],
24
+ 'M': ['ee Mount', 'engem Mount'],
25
+ 'MM': [number + ' Méint', number + ' Méint'],
26
+ 'y': ['ee Joer', 'engem Joer'],
27
+ 'yy': [number + ' Joer', number + ' Joer']
28
+ };
29
+ return withoutSuffix ? format[key][0] : format[key][1];
30
+ }
31
+
32
+ function processFutureTime(string) {
33
+ var number = string.substr(0, string.indexOf(' '));
34
+ if (eifelerRegelAppliesToNumber(number)) {
35
+ return "a " + string;
36
+ }
37
+ return "an " + string;
38
+ }
39
+
40
+ function processPastTime(string) {
41
+ var number = string.substr(0, string.indexOf(' '));
42
+ if (eifelerRegelAppliesToNumber(number)) {
43
+ return "viru " + string;
44
+ }
45
+ return "virun " + string;
46
+ }
47
+
48
+ function processLastWeek(string1) {
49
+ var weekday = this.format('d');
50
+ if (eifelerRegelAppliesToWeekday(weekday)) {
51
+ return '[Leschte] dddd [um] LT';
52
+ }
53
+ return '[Leschten] dddd [um] LT';
54
+ }
55
+
56
+ /**
57
+ * Returns true if the word before the given week day loses the "-n" ending.
58
+ * e.g. "Leschten Dënschdeg" but "Leschte Méindeg"
59
+ *
60
+ * @param weekday {integer}
61
+ * @returns {boolean}
62
+ */
63
+ function eifelerRegelAppliesToWeekday(weekday) {
64
+ weekday = parseInt(weekday, 10);
65
+ switch (weekday) {
66
+ case 0: // Sonndeg
67
+ case 1: // Méindeg
68
+ case 3: // Mëttwoch
69
+ case 5: // Freideg
70
+ case 6: // Samschdeg
71
+ return true;
72
+ default: // 2 Dënschdeg, 4 Donneschdeg
73
+ return false;
74
+ }
75
+ }
76
+
77
+ /**
78
+ * Returns true if the word before the given number loses the "-n" ending.
79
+ * e.g. "an 10 Deeg" but "a 5 Deeg"
80
+ *
81
+ * @param number {integer}
82
+ * @returns {boolean}
83
+ */
84
+ function eifelerRegelAppliesToNumber(number) {
85
+ number = parseInt(number, 10);
86
+ if (isNaN(number)) {
87
+ return false;
88
+ }
89
+ if (number < 0) {
90
+ // Negative Number --> always true
91
+ return true;
92
+ } else if (number < 10) {
93
+ // Only 1 digit
94
+ if (4 <= number && number <= 7) {
95
+ return true;
96
+ }
97
+ return false;
98
+ } else if (number < 100) {
99
+ // 2 digits
100
+ var lastDigit = number % 10, firstDigit = number / 10;
101
+ if (lastDigit === 0) {
102
+ return eifelerRegelAppliesToNumber(firstDigit);
103
+ }
104
+ return eifelerRegelAppliesToNumber(lastDigit);
105
+ } else if (number < 10000) {
106
+ // 3 or 4 digits --> recursively check first digit
107
+ while (number >= 10) {
108
+ number = number / 10;
109
+ }
110
+ return eifelerRegelAppliesToNumber(number);
111
+ } else {
112
+ // Anything larger than 4 digits: recursively check first n-3 digits
113
+ number = number / 1000;
114
+ return eifelerRegelAppliesToNumber(number);
115
+ }
116
+ }
117
+
118
+ return moment.lang('lb', {
119
+ months: "Januar_Februar_Mäerz_Abrëll_Mee_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),
120
+ monthsShort: "Jan._Febr._Mrz._Abr._Mee_Jun._Jul._Aug._Sept._Okt._Nov._Dez.".split("_"),
121
+ weekdays: "Sonndeg_Méindeg_Dënschdeg_Mëttwoch_Donneschdeg_Freideg_Samschdeg".split("_"),
122
+ weekdaysShort: "So._Mé._Dë._Më._Do._Fr._Sa.".split("_"),
123
+ weekdaysMin: "So_Mé_Dë_Më_Do_Fr_Sa".split("_"),
124
+ longDateFormat: {
125
+ LT: "H:mm [Auer]",
126
+ L: "DD.MM.YYYY",
127
+ LL: "D. MMMM YYYY",
128
+ LLL: "D. MMMM YYYY LT",
129
+ LLLL: "dddd, D. MMMM YYYY LT"
130
+ },
131
+ calendar: {
132
+ sameDay: "[Haut um] LT",
133
+ sameElse: "L",
134
+ nextDay: '[Muer um] LT',
135
+ nextWeek: 'dddd [um] LT',
136
+ lastDay: '[Gëschter um] LT',
137
+ lastWeek: processLastWeek
138
+ },
139
+ relativeTime: {
140
+ future: processFutureTime,
141
+ past: processPastTime,
142
+ s: "e puer Sekonnen",
143
+ m: processRelativeTime,
144
+ mm: "%d Minutten",
145
+ h: processRelativeTime,
146
+ hh: "%d Stonnen",
147
+ d: processRelativeTime,
148
+ dd: processRelativeTime,
149
+ M: processRelativeTime,
150
+ MM: processRelativeTime,
151
+ y: processRelativeTime,
152
+ yy: processRelativeTime
153
+ },
154
+ ordinal: '%d.',
155
+ week: {
156
+ dow: 1, // Monday is the first day of the week.
157
+ doy: 4 // The week that contains Jan 4th is the first week of the year.
158
+ }
159
+ });
160
+ }));
@@ -0,0 +1,86 @@
1
+ // moment.js language configuration
2
+ // language : macedonian (mk)
3
+ // author : Borislav Mickov : https://github.com/B0k0
4
+
5
+ (function (factory) {
6
+ if (typeof define === 'function' && define.amd) {
7
+ define(['moment'], factory); // AMD
8
+ } else if (typeof exports === 'object') {
9
+ module.exports = factory(require('../moment')); // Node
10
+ } else {
11
+ factory(window.moment); // Browser global
12
+ }
13
+ }(function (moment) {
14
+ return moment.lang('mk', {
15
+ months : "јануари_февруари_март_април_мај_јуни_јули_август_септември_октомври_ноември_декември".split("_"),
16
+ monthsShort : "јан_фев_мар_апр_мај_јун_јул_авг_сеп_окт_ное_дек".split("_"),
17
+ weekdays : "недела_понеделник_вторник_среда_четврток_петок_сабота".split("_"),
18
+ weekdaysShort : "нед_пон_вто_сре_чет_пет_саб".split("_"),
19
+ weekdaysMin : "нe_пo_вт_ср_че_пе_сa".split("_"),
20
+ longDateFormat : {
21
+ LT : "H:mm",
22
+ L : "D.MM.YYYY",
23
+ LL : "D MMMM YYYY",
24
+ LLL : "D MMMM YYYY LT",
25
+ LLLL : "dddd, D MMMM YYYY LT"
26
+ },
27
+ calendar : {
28
+ sameDay : '[Денес во] LT',
29
+ nextDay : '[Утре во] LT',
30
+ nextWeek : 'dddd [во] LT',
31
+ lastDay : '[Вчера во] LT',
32
+ lastWeek : function () {
33
+ switch (this.day()) {
34
+ case 0:
35
+ case 3:
36
+ case 6:
37
+ return '[Во изминатата] dddd [во] LT';
38
+ case 1:
39
+ case 2:
40
+ case 4:
41
+ case 5:
42
+ return '[Во изминатиот] dddd [во] LT';
43
+ }
44
+ },
45
+ sameElse : 'L'
46
+ },
47
+ relativeTime : {
48
+ future : "после %s",
49
+ past : "пред %s",
50
+ s : "неколку секунди",
51
+ m : "минута",
52
+ mm : "%d минути",
53
+ h : "час",
54
+ hh : "%d часа",
55
+ d : "ден",
56
+ dd : "%d дена",
57
+ M : "месец",
58
+ MM : "%d месеци",
59
+ y : "година",
60
+ yy : "%d години"
61
+ },
62
+ ordinal : function (number) {
63
+ var lastDigit = number % 10,
64
+ last2Digits = number % 100;
65
+ if (number === 0) {
66
+ return number + '-ев';
67
+ } else if (last2Digits === 0) {
68
+ return number + '-ен';
69
+ } else if (last2Digits > 10 && last2Digits < 20) {
70
+ return number + '-ти';
71
+ } else if (lastDigit === 1) {
72
+ return number + '-ви';
73
+ } else if (lastDigit === 2) {
74
+ return number + '-ри';
75
+ } else if (lastDigit === 7 || lastDigit === 8) {
76
+ return number + '-ми';
77
+ } else {
78
+ return number + '-ти';
79
+ }
80
+ },
81
+ week : {
82
+ dow : 1, // Monday is the first day of the week.
83
+ doy : 7 // The week that contains Jan 1st is the first week of the year.
84
+ }
85
+ });
86
+ }));
@@ -15,7 +15,7 @@
15
15
  monthsSubjective = "stycznia_lutego_marca_kwietnia_maja_czerwca_lipca_sierpnia_września_października_listopada_grudnia".split("_");
16
16
 
17
17
  function plural(n) {
18
- return (n % 10 < 5) && (n % 10 > 1) && (~~(n / 10) !== 1);
18
+ return (n % 10 < 5) && (n % 10 > 1) && ((~~(n / 10) % 10) !== 1);
19
19
  }
20
20
 
21
21
  function translate(number, withoutSuffix, key) {
@@ -12,15 +12,31 @@
12
12
  factory(window.moment); // Browser global
13
13
  }
14
14
  }(function (moment) {
15
+ function relativeTimeWithPlural(number, withoutSuffix, key) {
16
+ var format = {
17
+ 'mm': 'minute',
18
+ 'hh': 'ore',
19
+ 'dd': 'zile',
20
+ 'MM': 'luni',
21
+ 'yy': 'ani'
22
+ },
23
+ separator = ' ';
24
+ if (number % 100 >= 20 || (number >= 100 && number % 100 === 0)) {
25
+ separator = ' de ';
26
+ }
27
+
28
+ return number + separator + format[key];
29
+ }
30
+
15
31
  return moment.lang('ro', {
16
- months : "Ianuarie_Februarie_Martie_Aprilie_Mai_Iunie_Iulie_August_Septembrie_Octombrie_Noiembrie_Decembrie".split("_"),
17
- monthsShort : "Ian_Feb_Mar_Apr_Mai_Iun_Iul_Aug_Sep_Oct_Noi_Dec".split("_"),
18
- weekdays : "Duminică_Luni_Marţi_Miercuri_Joi_Vineri_Sâmbătă".split("_"),
32
+ months : "ianuarie_februarie_martie_aprilie_mai_iunie_iulie_august_septembrie_octombrie_noiembrie_decembrie".split("_"),
33
+ monthsShort : "ian_feb_mar_apr_mai_iun_iul_aug_sep_oct_noi_dec".split("_"),
34
+ weekdays : "duminică_luni_marți_miercuri_joi_vineri_sâmbătă".split("_"),
19
35
  weekdaysShort : "Dum_Lun_Mar_Mie_Joi_Vin_Sâm".split("_"),
20
36
  weekdaysMin : "Du_Lu_Ma_Mi_Jo_Vi_Sâ".split("_"),
21
37
  longDateFormat : {
22
38
  LT : "H:mm",
23
- L : "DD/MM/YYYY",
39
+ L : "DD.MM.YYYY",
24
40
  LL : "D MMMM YYYY",
25
41
  LLL : "D MMMM YYYY H:mm",
26
42
  LLLL : "dddd, D MMMM YYYY H:mm"
@@ -38,15 +54,15 @@
38
54
  past : "%s în urmă",
39
55
  s : "câteva secunde",
40
56
  m : "un minut",
41
- mm : "%d minute",
57
+ mm : relativeTimeWithPlural,
42
58
  h : "o oră",
43
- hh : "%d ore",
59
+ hh : relativeTimeWithPlural,
44
60
  d : "o zi",
45
- dd : "%d zile",
61
+ dd : relativeTimeWithPlural,
46
62
  M : "o lună",
47
- MM : "%d luni",
63
+ MM : relativeTimeWithPlural,
48
64
  y : "un an",
49
- yy : "%d ani"
65
+ yy : relativeTimeWithPlural
50
66
  },
51
67
  week : {
52
68
  dow : 1, // Monday is the first day of the week.
@@ -0,0 +1,139 @@
1
+ // moment.js language configuration
2
+ // language : serbian (rs)
3
+ // author : Limon Monte : https://github.com/limonte
4
+ // based on (bs) translation by Nedim Cholich
5
+
6
+ (function (factory) {
7
+ if (typeof define === 'function' && define.amd) {
8
+ define(['moment'], factory); // AMD
9
+ } else if (typeof exports === 'object') {
10
+ module.exports = factory(require('../moment')); // Node
11
+ } else {
12
+ factory(window.moment); // Browser global
13
+ }
14
+ }(function (moment) {
15
+
16
+ function translate(number, withoutSuffix, key) {
17
+ var result = number + " ";
18
+ switch (key) {
19
+ case 'm':
20
+ return withoutSuffix ? 'jedna minuta' : 'jedne minute';
21
+ case 'mm':
22
+ if (number === 1) {
23
+ result += 'minuta';
24
+ } else if (number === 2 || number === 3 || number === 4) {
25
+ result += 'minute';
26
+ } else {
27
+ result += 'minuta';
28
+ }
29
+ return result;
30
+ case 'h':
31
+ return withoutSuffix ? 'jedan sat' : 'jednog sata';
32
+ case 'hh':
33
+ if (number === 1) {
34
+ result += 'sat';
35
+ } else if (number === 2 || number === 3 || number === 4) {
36
+ result += 'sata';
37
+ } else {
38
+ result += 'sati';
39
+ }
40
+ return result;
41
+ case 'dd':
42
+ if (number === 1) {
43
+ result += 'dan';
44
+ } else {
45
+ result += 'dana';
46
+ }
47
+ return result;
48
+ case 'MM':
49
+ if (number === 1) {
50
+ result += 'mesec';
51
+ } else if (number === 2 || number === 3 || number === 4) {
52
+ result += 'meseca';
53
+ } else {
54
+ result += 'meseci';
55
+ }
56
+ return result;
57
+ case 'yy':
58
+ if (number === 1) {
59
+ result += 'godina';
60
+ } else if (number === 2 || number === 3 || number === 4) {
61
+ result += 'godine';
62
+ } else {
63
+ result += 'godina';
64
+ }
65
+ return result;
66
+ }
67
+ }
68
+
69
+ return moment.lang('rs', {
70
+ months : "januar_februar_mart_april_maj_jun_jul_avgust_septembar_oktobar_novembar_decembar".split("_"),
71
+ monthsShort : "jan._feb._mar._apr._maj._jun._jul._avg._sep._okt._nov._dec.".split("_"),
72
+ weekdays : "nedelja_ponedeljak_utorak_sreda_četvrtak_petak_subota".split("_"),
73
+ weekdaysShort : "ned._pon._uto._sre._čet._pet._sub.".split("_"),
74
+ weekdaysMin : "ne_po_ut_sr_če_pe_su".split("_"),
75
+ longDateFormat : {
76
+ LT : "H:mm",
77
+ L : "DD. MM. YYYY",
78
+ LL : "D. MMMM YYYY",
79
+ LLL : "D. MMMM YYYY LT",
80
+ LLLL : "dddd, D. MMMM YYYY LT"
81
+ },
82
+ calendar : {
83
+ sameDay : '[danas u] LT',
84
+ nextDay : '[sutra u] LT',
85
+
86
+ nextWeek : function () {
87
+ switch (this.day()) {
88
+ case 0:
89
+ return '[u] [nedelju] [u] LT';
90
+ case 3:
91
+ return '[u] [sredu] [u] LT';
92
+ case 6:
93
+ return '[u] [subotu] [u] LT';
94
+ case 1:
95
+ case 2:
96
+ case 4:
97
+ case 5:
98
+ return '[u] dddd [u] LT';
99
+ }
100
+ },
101
+ lastDay : '[juče u] LT',
102
+ lastWeek : function () {
103
+ switch (this.day()) {
104
+ case 0:
105
+ case 3:
106
+ return '[prošlu] dddd [u] LT';
107
+ case 6:
108
+ return '[prošle] [subote] [u] LT';
109
+ case 1:
110
+ case 2:
111
+ case 4:
112
+ case 5:
113
+ return '[prošli] dddd [u] LT';
114
+ }
115
+ },
116
+ sameElse : 'L'
117
+ },
118
+ relativeTime : {
119
+ future : "za %s",
120
+ past : "pre %s",
121
+ s : "par sekundi",
122
+ m : translate,
123
+ mm : translate,
124
+ h : translate,
125
+ hh : translate,
126
+ d : "dan",
127
+ dd : translate,
128
+ M : "mesec",
129
+ MM : translate,
130
+ y : "godinu",
131
+ yy : translate
132
+ },
133
+ ordinal : '%d.',
134
+ week : {
135
+ dow : 1, // Monday is the first day of the week.
136
+ doy : 7 // The week that contains Jan 1st is the first week of the year.
137
+ }
138
+ });
139
+ }));