rails-timeago 2.16.0 → 2.17.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +53 -0
- data/.travis.yml +20 -8
- data/CHANGELOG.md +8 -0
- data/Gemfile +3 -5
- data/Rakefile +14 -12
- data/lib/assets/javascripts/rails-timeago-all.js +4 -0
- data/lib/rails-timeago.rb +21 -17
- data/lib/rails-timeago/helper.rb +13 -10
- data/lib/rails-timeago/version.rb +4 -2
- data/rails-timeago.gemspec +13 -11
- data/spec/rails-timeago_spec.rb +2 -0
- data/spec/spec_helper.rb +2 -0
- data/spec/support/stub.rb +11 -9
- data/spec/timeago/helper_spec.rb +27 -25
- data/vendor/assets/javascripts/jquery.timeago.js +1 -1
- data/vendor/assets/javascripts/locales/jquery.timeago.af.js +30 -20
- data/vendor/assets/javascripts/locales/jquery.timeago.am.js +30 -0
- data/vendor/assets/javascripts/locales/jquery.timeago.ar.js +12 -4
- data/vendor/assets/javascripts/locales/jquery.timeago.az-short.js +30 -20
- data/vendor/assets/javascripts/locales/jquery.timeago.az.js +30 -20
- data/vendor/assets/javascripts/locales/jquery.timeago.be.js +43 -0
- data/vendor/assets/javascripts/locales/jquery.timeago.bg.js +28 -18
- data/vendor/assets/javascripts/locales/jquery.timeago.bs.js +13 -7
- data/vendor/assets/javascripts/locales/jquery.timeago.ca.js +30 -20
- data/vendor/assets/javascripts/locales/jquery.timeago.cs.js +34 -24
- data/vendor/assets/javascripts/locales/jquery.timeago.cy.js +30 -20
- data/vendor/assets/javascripts/locales/jquery.timeago.da.js +28 -18
- data/vendor/assets/javascripts/locales/jquery.timeago.de-short.js +30 -20
- data/vendor/assets/javascripts/locales/jquery.timeago.de.js +28 -18
- data/vendor/assets/javascripts/locales/jquery.timeago.dv.js +32 -22
- data/vendor/assets/javascripts/locales/jquery.timeago.el.js +28 -18
- data/vendor/assets/javascripts/locales/jquery.timeago.en-short.js +30 -20
- data/vendor/assets/javascripts/locales/jquery.timeago.es-short.js +31 -20
- data/vendor/assets/javascripts/locales/jquery.timeago.es.js +29 -18
- data/vendor/assets/javascripts/locales/jquery.timeago.et.js +28 -18
- data/vendor/assets/javascripts/locales/jquery.timeago.eu.js +28 -17
- data/vendor/assets/javascripts/locales/jquery.timeago.fa-short.js +30 -20
- data/vendor/assets/javascripts/locales/jquery.timeago.fa.js +32 -22
- data/vendor/assets/javascripts/locales/jquery.timeago.fi.js +38 -28
- data/vendor/assets/javascripts/locales/jquery.timeago.fr-short.js +26 -16
- data/vendor/assets/javascripts/locales/jquery.timeago.fr.js +27 -17
- data/vendor/assets/javascripts/locales/jquery.timeago.gl.js +28 -18
- data/vendor/assets/javascripts/locales/jquery.timeago.he.js +26 -16
- data/vendor/assets/javascripts/locales/jquery.timeago.hr.js +53 -48
- data/vendor/assets/javascripts/locales/jquery.timeago.hu.js +28 -18
- data/vendor/assets/javascripts/locales/jquery.timeago.hy.js +28 -18
- data/vendor/assets/javascripts/locales/jquery.timeago.id.js +29 -18
- data/vendor/assets/javascripts/locales/jquery.timeago.is.js +29 -19
- data/vendor/assets/javascripts/locales/jquery.timeago.it-short.js +30 -20
- data/vendor/assets/javascripts/locales/jquery.timeago.it.js +28 -16
- data/vendor/assets/javascripts/locales/jquery.timeago.ja.js +29 -19
- data/vendor/assets/javascripts/locales/jquery.timeago.jv.js +28 -18
- data/vendor/assets/javascripts/locales/jquery.timeago.ko.js +31 -20
- data/vendor/assets/javascripts/locales/jquery.timeago.ky.js +11 -3
- data/vendor/assets/javascripts/locales/jquery.timeago.lt.js +30 -20
- data/vendor/assets/javascripts/locales/jquery.timeago.lv.js +30 -20
- data/vendor/assets/javascripts/locales/jquery.timeago.mk.js +30 -20
- data/vendor/assets/javascripts/locales/jquery.timeago.nl.js +30 -20
- data/vendor/assets/javascripts/locales/jquery.timeago.no.js +28 -18
- data/vendor/assets/javascripts/locales/jquery.timeago.pl.js +11 -3
- data/vendor/assets/javascripts/locales/jquery.timeago.pt-br-short.js +30 -20
- data/vendor/assets/javascripts/locales/jquery.timeago.pt-br.js +28 -18
- data/vendor/assets/javascripts/locales/jquery.timeago.pt-short.js +30 -20
- data/vendor/assets/javascripts/locales/jquery.timeago.pt.js +26 -16
- data/vendor/assets/javascripts/locales/jquery.timeago.ro.js +29 -18
- data/vendor/assets/javascripts/locales/jquery.timeago.rs.js +53 -48
- data/vendor/assets/javascripts/locales/jquery.timeago.ru.js +11 -3
- data/vendor/assets/javascripts/locales/jquery.timeago.rw.js +30 -20
- data/vendor/assets/javascripts/locales/jquery.timeago.si.js +28 -18
- data/vendor/assets/javascripts/locales/jquery.timeago.sk.js +34 -24
- data/vendor/assets/javascripts/locales/jquery.timeago.sl.js +45 -39
- data/vendor/assets/javascripts/locales/jquery.timeago.sq.js +26 -0
- data/vendor/assets/javascripts/locales/jquery.timeago.sr.js +53 -48
- data/vendor/assets/javascripts/locales/jquery.timeago.sv.js +28 -18
- data/vendor/assets/javascripts/locales/jquery.timeago.th.js +30 -20
- data/vendor/assets/javascripts/locales/jquery.timeago.tr-short.js +30 -20
- data/vendor/assets/javascripts/locales/jquery.timeago.tr.js +26 -16
- data/vendor/assets/javascripts/locales/jquery.timeago.uk.js +11 -3
- data/vendor/assets/javascripts/locales/jquery.timeago.ur.js +30 -0
- data/vendor/assets/javascripts/locales/jquery.timeago.uz.js +29 -19
- data/vendor/assets/javascripts/locales/jquery.timeago.vi.js +30 -20
- data/vendor/assets/javascripts/locales/jquery.timeago.zh-CN.js +31 -20
- data/vendor/assets/javascripts/locales/jquery.timeago.zh-TW.js +30 -20
- metadata +8 -4
data/spec/timeago/helper_spec.rb
CHANGED
@@ -1,19 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
RSpec.describe Rails::Timeago::Helper do
|
4
6
|
before { @stub = TimeagoStub.new }
|
5
7
|
let(:time) { Time.now }
|
6
8
|
|
7
|
-
context
|
9
|
+
context '#timeago_tag' do
|
8
10
|
let(:kwargs) { {} }
|
9
11
|
subject { @stub.timeago_tag(time, **kwargs) }
|
10
12
|
|
11
13
|
it 'creates a time tag' do
|
12
|
-
is_expected.to match
|
14
|
+
is_expected.to match %r{<time.*>.*</time>}
|
13
15
|
end
|
14
16
|
|
15
17
|
it 'has a title attribute' do
|
16
|
-
is_expected.to match
|
18
|
+
is_expected.to match %r{<time.*title=".*".*>.*</time>}
|
17
19
|
end
|
18
20
|
|
19
21
|
it 'has a human readable datetime as title attribute' do
|
@@ -21,7 +23,7 @@ RSpec.describe Rails::Timeago::Helper do
|
|
21
23
|
end
|
22
24
|
|
23
25
|
it 'has a data-time-ago attribute' do
|
24
|
-
is_expected.to match
|
26
|
+
is_expected.to match %r{<time.*data-time-ago=".*".*>.*</time>}
|
25
27
|
end
|
26
28
|
|
27
29
|
context 'with nil as timestamp' do
|
@@ -40,7 +42,7 @@ RSpec.describe Rails::Timeago::Helper do
|
|
40
42
|
end
|
41
43
|
|
42
44
|
context 'with proc format' do
|
43
|
-
let(:format) { proc {|
|
45
|
+
let(:format) { proc {|_time, _options| :long } }
|
44
46
|
it { is_expected.to include "title=\"#{I18n.l time, format: :long}\"" }
|
45
47
|
end
|
46
48
|
end
|
@@ -54,7 +56,7 @@ RSpec.describe Rails::Timeago::Helper do
|
|
54
56
|
end
|
55
57
|
|
56
58
|
context 'with proc format' do
|
57
|
-
let(:format) { proc {|
|
59
|
+
let(:format) { proc {|_time, _options| :long } }
|
58
60
|
it { is_expected.to include "title=\"#{I18n.l time, format: :long}\"" }
|
59
61
|
end
|
60
62
|
end
|
@@ -64,18 +66,18 @@ RSpec.describe Rails::Timeago::Helper do
|
|
64
66
|
|
65
67
|
context 'with title disable' do
|
66
68
|
let(:title) { false }
|
67
|
-
it { is_expected.to_not match
|
69
|
+
it { is_expected.to_not match %r{<time.*title=".*".*>.*</time>} }
|
68
70
|
end
|
69
71
|
|
70
72
|
context 'with title set to nil' do
|
71
73
|
let(:title) { nil }
|
72
|
-
it { is_expected.to_not match
|
74
|
+
it { is_expected.to_not match %r{<time.*title=".*".*>.*</time>} }
|
73
75
|
end
|
74
76
|
|
75
77
|
context 'with title set to proc' do
|
76
78
|
let(:title) { proc {|_, o| o[:format] } }
|
77
79
|
let(:kwargs) { super().merge format: :short }
|
78
|
-
it { is_expected.to match
|
80
|
+
it { is_expected.to match %r{<time.*title="short".*>.*</time>} }
|
79
81
|
end
|
80
82
|
end
|
81
83
|
|
@@ -84,18 +86,18 @@ RSpec.describe Rails::Timeago::Helper do
|
|
84
86
|
|
85
87
|
context 'with title disabled' do
|
86
88
|
let(:title) { false }
|
87
|
-
it { is_expected.to_not match
|
89
|
+
it { is_expected.to_not match %r{<time.*title=".*".*>.*</time>} }
|
88
90
|
end
|
89
91
|
|
90
92
|
context 'with title set to nil' do
|
91
93
|
let(:title) { nil }
|
92
|
-
it { is_expected.to_not match
|
94
|
+
it { is_expected.to_not match %r{<time.*title=".*".*>.*</time>} }
|
93
95
|
end
|
94
96
|
|
95
97
|
context 'with title set to proc' do
|
96
98
|
let(:title) { proc {|_, o| o[:format] } }
|
97
99
|
let(:kwargs) { {format: :short} }
|
98
|
-
it { is_expected.to match
|
100
|
+
it { is_expected.to match %r{<time.*title="short".*>.*</time>} }
|
99
101
|
end
|
100
102
|
end
|
101
103
|
|
@@ -103,7 +105,7 @@ RSpec.describe Rails::Timeago::Helper do
|
|
103
105
|
let(:time) { 5.days.ago }
|
104
106
|
|
105
107
|
it 'should not have data-time-ago attribute for times before limit' do
|
106
|
-
is_expected.to_not match
|
108
|
+
is_expected.to_not match %r{<time.*data-time-ago=".*".*>.*</time>}
|
107
109
|
end
|
108
110
|
|
109
111
|
context 'with given limit' do
|
@@ -114,16 +116,16 @@ RSpec.describe Rails::Timeago::Helper do
|
|
114
116
|
|
115
117
|
context 'and past timestamp after limit' do
|
116
118
|
let(:time) { 5.days.ago }
|
117
|
-
it { is_expected.to match
|
119
|
+
it { is_expected.to match %r{<time.*data-time-ago=".*".*>.*</time>} }
|
118
120
|
end
|
119
121
|
|
120
122
|
context 'and past timestamp before limit' do
|
121
123
|
let(:time) { 8.days.ago }
|
122
|
-
it { is_expected.to_not match
|
124
|
+
it { is_expected.to_not match %r{<time.*data-time-ago=".*".*>.*</time>} }
|
123
125
|
|
124
126
|
context 'when forced' do
|
125
127
|
let(:kwargs) { super().merge force: true }
|
126
|
-
it { is_expected.to match
|
128
|
+
it { is_expected.to match %r{<time.*data-time-ago=".*".*>.*</time>} }
|
127
129
|
end
|
128
130
|
end
|
129
131
|
end
|
@@ -133,17 +135,17 @@ RSpec.describe Rails::Timeago::Helper do
|
|
133
135
|
|
134
136
|
context 'and future timestamp after limit' do
|
135
137
|
let(:time) { 7.days.from_now }
|
136
|
-
it { is_expected.to_not match
|
138
|
+
it { is_expected.to_not match %r{<time.*data-time-ago=".*".*>.*</time>} }
|
137
139
|
end
|
138
140
|
|
139
141
|
context 'and future timestamp before limit' do
|
140
142
|
let(:time) { 3.days.from_now }
|
141
|
-
it { is_expected.to match
|
143
|
+
it { is_expected.to match %r{<time.*data-time-ago=".*".*>.*</time>} }
|
142
144
|
end
|
143
145
|
|
144
146
|
context 'and past timestamp' do
|
145
147
|
let(:time) { 3.days.ago }
|
146
|
-
it { is_expected.to_not match
|
148
|
+
it { is_expected.to_not match %r{<time.*data-time-ago=".*".*>.*</time>} }
|
147
149
|
end
|
148
150
|
end
|
149
151
|
end
|
@@ -178,12 +180,12 @@ RSpec.describe Rails::Timeago::Helper do
|
|
178
180
|
let(:kwargs) { {nojs: true} }
|
179
181
|
|
180
182
|
it 'has time in words as content' do
|
181
|
-
is_expected.to match
|
183
|
+
is_expected.to match %r{<time.*>%time_ago_in_words%</time>}
|
182
184
|
end
|
183
185
|
|
184
186
|
context 'with limit' do
|
185
187
|
let(:kwargs) { super().merge limit: 2.days.ago }
|
186
|
-
it { is_expected.to_not match
|
188
|
+
it { is_expected.to_not match %r{<time.*data-time-ago=".*".*>.*</time>} }
|
187
189
|
it { is_expected.to include ">#{I18n.l time.to_date}<" }
|
188
190
|
end
|
189
191
|
end
|
@@ -192,16 +194,16 @@ RSpec.describe Rails::Timeago::Helper do
|
|
192
194
|
let(:kwargs) { {myattr: 'abc'} }
|
193
195
|
|
194
196
|
it 'passes them to #tag_helper' do
|
195
|
-
is_expected.to match
|
197
|
+
is_expected.to match %r{<time.*myattr="abc".*>.*<\/time>}
|
196
198
|
end
|
197
199
|
end
|
198
200
|
end
|
199
201
|
|
200
|
-
context
|
202
|
+
context '#timeago_script_tag' do
|
201
203
|
subject { @stub.timeago_script_tag }
|
202
204
|
|
203
|
-
it
|
204
|
-
I18n.locale =
|
205
|
+
it 'should return a javascript snippet to set jQuery timeago locale' do
|
206
|
+
I18n.locale = 'en'
|
205
207
|
is_expected.to eq '<script>jQuery.timeago.settings.lang="en";</script>'
|
206
208
|
end
|
207
209
|
end
|
@@ -1,20 +1,30 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
1
|
+
(function (factory) {
|
2
|
+
if (typeof define === 'function' && define.amd) {
|
3
|
+
define(['jquery'], factory);
|
4
|
+
} else if (typeof module === 'object' && typeof module.exports === 'object') {
|
5
|
+
factory(require('jquery'));
|
6
|
+
} else {
|
7
|
+
factory(jQuery);
|
8
|
+
}
|
9
|
+
}(function (jQuery) {
|
10
|
+
// Afrikaans
|
11
|
+
jQuery.timeago.settings.strings["af"] = {
|
12
|
+
prefixAgo: null,
|
13
|
+
prefixFromNow: null,
|
14
|
+
suffixAgo: "gelede",
|
15
|
+
suffixFromNow: "van nou af",
|
16
|
+
seconds: "%d sekondes",
|
17
|
+
minute: "1 minuut",
|
18
|
+
minutes: "%d minute",
|
19
|
+
hour: "1 uur",
|
20
|
+
hours: "%d ure",
|
21
|
+
day: "1 dag",
|
22
|
+
days: "%d dae",
|
23
|
+
month: "1 maand",
|
24
|
+
months: "%d maande",
|
25
|
+
year: "1 jaar",
|
26
|
+
years: "%d jaar",
|
27
|
+
wordSeparator: " ",
|
28
|
+
numbers: []
|
29
|
+
};
|
30
|
+
}));
|
@@ -0,0 +1,30 @@
|
|
1
|
+
(function (factory) {
|
2
|
+
if (typeof define === 'function' && define.amd) {
|
3
|
+
define(['jquery'], factory);
|
4
|
+
} else if (typeof module === 'object' && typeof module.exports === 'object') {
|
5
|
+
factory(require('jquery'));
|
6
|
+
} else {
|
7
|
+
factory(jQuery);
|
8
|
+
}
|
9
|
+
}(function (jQuery) {
|
10
|
+
// Amharic
|
11
|
+
jQuery.timeago.settings.strings["am"] = {
|
12
|
+
prefixAgo: null,
|
13
|
+
prefixFromNow: null,
|
14
|
+
suffixAgo: "በፊት",
|
15
|
+
suffixFromNow: "በኋላ",
|
16
|
+
seconds: "ከአንድ ደቂቃ በታች",
|
17
|
+
minute: "ከአንድ ደቂቃ ገደማ",
|
18
|
+
minutes: "ከ%d ደቂቃ",
|
19
|
+
hour: "ከአንድ ሰዓት ገደማ",
|
20
|
+
hours: "ከ%d ሰዓት ገደማ",
|
21
|
+
day: "ከአንድ ቀን",
|
22
|
+
days: "ከ%d ቀን",
|
23
|
+
month: "ከአንድ ወር ገደማ",
|
24
|
+
months: "ከ%d ወር",
|
25
|
+
year: "ከአንድ ዓመት ገደማ",
|
26
|
+
years: "ከ%d ዓመት",
|
27
|
+
wordSeparator: " ",
|
28
|
+
numbers: []
|
29
|
+
};
|
30
|
+
}));
|
@@ -1,9 +1,17 @@
|
|
1
|
-
(function() {
|
1
|
+
(function (factory) {
|
2
|
+
if (typeof define === 'function' && define.amd) {
|
3
|
+
define(['jquery'], factory);
|
4
|
+
} else if (typeof module === 'object' && typeof module.exports === 'object') {
|
5
|
+
factory(require('jquery'));
|
6
|
+
} else {
|
7
|
+
factory(jQuery);
|
8
|
+
}
|
9
|
+
}(function (jQuery) {
|
2
10
|
function numpf(n, a) {
|
3
11
|
return a[plural=n===0 ? 0 : n===1 ? 1 : n===2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 ? 4 : 5];
|
4
12
|
}
|
5
|
-
|
6
|
-
jQuery.timeago.settings.strings["ar"] = {
|
13
|
+
|
14
|
+
jQuery.timeago.settings.strings["ar"] = {
|
7
15
|
prefixAgo: "منذ",
|
8
16
|
prefixFromNow: "بعد",
|
9
17
|
suffixAgo: null,
|
@@ -93,4 +101,4 @@ jQuery.timeago.settings.strings["ar"] = {
|
|
93
101
|
'%d عامًا',
|
94
102
|
'%d عام']);}
|
95
103
|
};
|
96
|
-
})
|
104
|
+
}));
|
@@ -1,20 +1,30 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
1
|
+
(function (factory) {
|
2
|
+
if (typeof define === 'function' && define.amd) {
|
3
|
+
define(['jquery'], factory);
|
4
|
+
} else if (typeof module === 'object' && typeof module.exports === 'object') {
|
5
|
+
factory(require('jquery'));
|
6
|
+
} else {
|
7
|
+
factory(jQuery);
|
8
|
+
}
|
9
|
+
}(function (jQuery) {
|
10
|
+
// Azerbaijani shortened
|
11
|
+
jQuery.timeago.settings.strings["az-short"] = {
|
12
|
+
prefixAgo: null,
|
13
|
+
prefixFromNow: null,
|
14
|
+
suffixAgo: "",
|
15
|
+
suffixFromNow: "",
|
16
|
+
seconds: '1 dəq',
|
17
|
+
minute: '1 dəq',
|
18
|
+
minutes: '%d dəq',
|
19
|
+
hour: '1 saat',
|
20
|
+
hours: '%d saat',
|
21
|
+
day: '1 gün',
|
22
|
+
days: '%d gün',
|
23
|
+
month: '1 ay',
|
24
|
+
months: '%d ay',
|
25
|
+
year: '1 il',
|
26
|
+
years: '%d il',
|
27
|
+
wordSeparator: '',
|
28
|
+
numbers: []
|
29
|
+
};
|
30
|
+
}));
|
@@ -1,20 +1,30 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
1
|
+
(function (factory) {
|
2
|
+
if (typeof define === 'function' && define.amd) {
|
3
|
+
define(['jquery'], factory);
|
4
|
+
} else if (typeof module === 'object' && typeof module.exports === 'object') {
|
5
|
+
factory(require('jquery'));
|
6
|
+
} else {
|
7
|
+
factory(jQuery);
|
8
|
+
}
|
9
|
+
}(function (jQuery) {
|
10
|
+
// Azerbaijani
|
11
|
+
jQuery.timeago.settings.strings["az"] = {
|
12
|
+
prefixAgo: null,
|
13
|
+
prefixFromNow: null,
|
14
|
+
suffixAgo: 'əvvəl',
|
15
|
+
suffixFromNow: 'sonra',
|
16
|
+
seconds: 'saniyələr',
|
17
|
+
minute: '1 dəqiqə',
|
18
|
+
minutes: '%d dəqiqə',
|
19
|
+
hour: '1 saat',
|
20
|
+
hours: '%d saat',
|
21
|
+
day: '1 gün',
|
22
|
+
days: '%d gün',
|
23
|
+
month: '1 ay',
|
24
|
+
months: '%d ay',
|
25
|
+
year: '1 il',
|
26
|
+
years: '%d il',
|
27
|
+
wordSeparator: '',
|
28
|
+
numbers: []
|
29
|
+
};
|
30
|
+
}));
|
@@ -0,0 +1,43 @@
|
|
1
|
+
(function (factory) {
|
2
|
+
if (typeof define === 'function' && define.amd) {
|
3
|
+
define(['jquery'], factory);
|
4
|
+
} else if (typeof module === 'object' && typeof module.exports === 'object') {
|
5
|
+
factory(require('jquery'));
|
6
|
+
} else {
|
7
|
+
factory(jQuery);
|
8
|
+
}
|
9
|
+
}(function (jQuery) {
|
10
|
+
// Belarusian
|
11
|
+
function numpf(n, f, s, t) {
|
12
|
+
// f - 1, 21, 31, ...
|
13
|
+
// s - 2-4, 22-24, 32-34 ...
|
14
|
+
// t - 5-20, 25-30, ...
|
15
|
+
n = n % 100;
|
16
|
+
var n10 = n % 10;
|
17
|
+
if ( (n10 === 1) && ( (n === 1) || (n > 20) ) ) {
|
18
|
+
return f;
|
19
|
+
} else if ( (n10 > 1) && (n10 < 5) && ( (n > 20) || (n < 10) ) ) {
|
20
|
+
return s;
|
21
|
+
} else {
|
22
|
+
return t;
|
23
|
+
}
|
24
|
+
}
|
25
|
+
|
26
|
+
jQuery.timeago.settings.strings["be"] = {
|
27
|
+
prefixAgo: null,
|
28
|
+
prefixFromNow: "праз",
|
29
|
+
suffixAgo: "таму",
|
30
|
+
suffixFromNow: null,
|
31
|
+
seconds: "менш хвіліны",
|
32
|
+
minute: "хвіліну",
|
33
|
+
minutes: function(value) { return numpf(value, "%d хвіліна", "%d хвіліны", "%d хвілін"); },
|
34
|
+
hour: "гадзіну",
|
35
|
+
hours: function(value) { return numpf(value, "%d гадзіна", "%d гадзіны", "%d гадзін"); },
|
36
|
+
day: "дзень",
|
37
|
+
days: function(value) { return numpf(value, "%d дзень", "%d дні", "%d дзён"); },
|
38
|
+
month: "месяц",
|
39
|
+
months: function(value) { return numpf(value, "%d месяц", "%d месяцы", "%d месяцаў"); },
|
40
|
+
year: "год",
|
41
|
+
years: function(value) { return numpf(value, "%d год", "%d гады", "%d гадоў"); }
|
42
|
+
};
|
43
|
+
}));
|
@@ -1,18 +1,28 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
1
|
+
(function (factory) {
|
2
|
+
if (typeof define === 'function' && define.amd) {
|
3
|
+
define(['jquery'], factory);
|
4
|
+
} else if (typeof module === 'object' && typeof module.exports === 'object') {
|
5
|
+
factory(require('jquery'));
|
6
|
+
} else {
|
7
|
+
factory(jQuery);
|
8
|
+
}
|
9
|
+
}(function (jQuery) {
|
10
|
+
// Bulgarian
|
11
|
+
jQuery.timeago.settings.strings["bg"] = {
|
12
|
+
prefixAgo: "преди",
|
13
|
+
prefixFromNow: "след",
|
14
|
+
suffixAgo: null,
|
15
|
+
suffixFromNow: null,
|
16
|
+
seconds: "по-малко от минута",
|
17
|
+
minute: "една минута",
|
18
|
+
minutes: "%d минути",
|
19
|
+
hour: "един час",
|
20
|
+
hours: "%d часа",
|
21
|
+
day: "един ден",
|
22
|
+
days: "%d дни",
|
23
|
+
month: "един месец",
|
24
|
+
months: "%d месеца",
|
25
|
+
year: "една година",
|
26
|
+
years: "%d години"
|
27
|
+
};
|
28
|
+
}));
|