jekyll-timeago 0.12.2 → 0.12.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +2 -2
- data/lib/jekyll-timeago.rb +13 -1
- data/lib/jekyll-timeago/version.rb +1 -1
- data/lib/locales/ru.yml +24 -0
- data/spec/jekyll-timeago_spec.rb +5 -1
- data/spec/source/_config.yml +3 -2
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7a7f64001d4339005b10a76ade11cbd172de94b04cf612df66cdb854cd4ddb10
|
4
|
+
data.tar.gz: b76814cbbc3aafa0f418fa13b1ebdab98d7d8cda3e49bd25404ae5de1b304301
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5164c7ffbfd45f036a692249d98a9ef5af101f2789b62fb46fbabb60468185f9e7556a9936268cf7939524f516361feba8651fe3a0de641893bf4c63bf919d1f
|
7
|
+
data.tar.gz: e7c74022476314a128f510c7e8ae34af8dd0b57b5689273c9c293bc636ad5c4b9618b05a57976670396c510234fe43680ae29d0deab9772a942be6131974d9e8
|
data/README.md
CHANGED
@@ -15,7 +15,7 @@ Main features:
|
|
15
15
|
- Level of detail customization
|
16
16
|
- Command line utility
|
17
17
|
|
18
|
-
In fact, `jekyll-timeago` started as an extension for the [Liquid](https://github.com/Shopify/liquid) template engine, to be used in Jekyll and Octopress backed sites. But actually, you can use it easily
|
18
|
+
In fact, `jekyll-timeago` started as an extension for the [Liquid](https://github.com/Shopify/liquid) template engine, to be used in Jekyll and Octopress backed sites. But actually, you can use it easily on any Ruby project and even as a tool from the [terminal](#cli)!
|
19
19
|
|
20
20
|
Read more about the `Jekyll` integration [in this section](#jekyll-integration).
|
21
21
|
|
@@ -124,7 +124,7 @@ If you want to contribute and support more default languages, please feel free t
|
|
124
124
|
|
125
125
|
## CLI
|
126
126
|
|
127
|
-
You can also `jekyll-timeago` from the command line:
|
127
|
+
You can also use `jekyll-timeago` from the command line:
|
128
128
|
|
129
129
|
```
|
130
130
|
> jekyll-timeago --help
|
data/lib/jekyll-timeago.rb
CHANGED
@@ -18,4 +18,16 @@ end
|
|
18
18
|
|
19
19
|
MiniI18n.configure do |config|
|
20
20
|
config.load_translations(__dir__ + '/locales/*.yml')
|
21
|
-
|
21
|
+
config.pluralization_rules = {
|
22
|
+
ru: -> (n) {
|
23
|
+
r = n % 10
|
24
|
+
if n != 11 && r == 1
|
25
|
+
'one'
|
26
|
+
elsif !(12..14).include?(n) && (2..4).include?(r)
|
27
|
+
'few'
|
28
|
+
else
|
29
|
+
'other'
|
30
|
+
end
|
31
|
+
}
|
32
|
+
}
|
33
|
+
end
|
data/lib/locales/ru.yml
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
ru:
|
2
|
+
today: 'сегодня'
|
3
|
+
yesterday: 'вчера'
|
4
|
+
tomorrow: 'завтра'
|
5
|
+
past: '%{date_range} назад'
|
6
|
+
future: 'через %{date_range}'
|
7
|
+
last_word_connector: 'и'
|
8
|
+
words_connector: ', '
|
9
|
+
years:
|
10
|
+
one: 'год'
|
11
|
+
few: '%{count} года'
|
12
|
+
other: '%{count} лет'
|
13
|
+
months:
|
14
|
+
one: 'месяц'
|
15
|
+
few: '%{count} месяца'
|
16
|
+
other: '%{count} месяцев'
|
17
|
+
weeks:
|
18
|
+
one: 'неделю'
|
19
|
+
few: '%{count} недели'
|
20
|
+
other: '%{count} недель'
|
21
|
+
days:
|
22
|
+
one: 'день'
|
23
|
+
few: '%{count} дня'
|
24
|
+
other: '%{count} дней'
|
data/spec/jekyll-timeago_spec.rb
CHANGED
@@ -50,6 +50,8 @@ describe Jekyll::Timeago do
|
|
50
50
|
it 'future time' do
|
51
51
|
expect(timeago(sample_date.next_day(7), sample_date)).to eq('in 1 week')
|
52
52
|
expect(timeago(sample_date.next_day(1000), sample_date)).to eq('in 2 years and 9 months')
|
53
|
+
expect(timeago(sample_date.next_day(7), sample_date, locale: :ru)).to eq('через неделю')
|
54
|
+
expect(timeago(sample_date.next_day(1000), sample_date, locale: :ru)).to eq('через 2 года и 9 месяцев')
|
53
55
|
end
|
54
56
|
|
55
57
|
it 'allow different date formats' do
|
@@ -71,6 +73,7 @@ describe Jekyll::Timeago do
|
|
71
73
|
|
72
74
|
it 'allow localization' do
|
73
75
|
expect(timeago(sample_date.prev_day(100), sample_date, locale: :fr)).to eq('il y a environ 3 mois et 1 semaine')
|
76
|
+
expect(timeago(sample_date.prev_day(100), sample_date, locale: :ru)).to eq('3 месяца и неделю назад')
|
74
77
|
end
|
75
78
|
end
|
76
79
|
|
@@ -96,6 +99,7 @@ describe Jekyll::Timeago do
|
|
96
99
|
it 'with custom locale' do
|
97
100
|
expect(`bin/jekyll-timeago 2016-1-1 2016-1-5 -l fr`).to match("il y a environ 4 jours")
|
98
101
|
expect(`bin/jekyll-timeago 2016-1-1 2016-1-5 --locale fr`).to match("il y a environ 4 jours")
|
102
|
+
expect(`bin/jekyll-timeago 2016-1-1 2016-1-5 --locale ru`).to match("4 дня назад")
|
99
103
|
end
|
100
104
|
end
|
101
|
-
end
|
105
|
+
end
|
data/spec/source/_config.yml
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-timeago
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.12.
|
4
|
+
version: 0.12.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- markets
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-01-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mini_i18n
|
@@ -140,6 +140,7 @@ files:
|
|
140
140
|
- lib/locales/fr.yml
|
141
141
|
- lib/locales/it.yml
|
142
142
|
- lib/locales/pt.yml
|
143
|
+
- lib/locales/ru.yml
|
143
144
|
- spec/jekyll-timeago_spec.rb
|
144
145
|
- spec/source/_config.yml
|
145
146
|
- spec/source/_locales/overrides.yaml
|
@@ -165,7 +166,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
165
166
|
version: '0'
|
166
167
|
requirements: []
|
167
168
|
rubyforge_project:
|
168
|
-
rubygems_version: 2.6
|
169
|
+
rubygems_version: 2.7.6
|
169
170
|
signing_key:
|
170
171
|
specification_version: 4
|
171
172
|
summary: A date helper to compute distance of dates in words.
|