edtf-humanize 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dcd453eb435bc411afc324c1fe00324311b91ad5feb2559cf44f6e7df30dc610
4
- data.tar.gz: '019a07057a906c4d45fe710c7034bab92a63fb86241ffca22858049c51bb4085'
3
+ metadata.gz: cc48511e90b2d4e45ff0be51e918e017d62d416e30e20c170a4fc5665995d47e
4
+ data.tar.gz: eabab9819e11f79c8b99e510e8136f8458724e4314b8e0dd8cc5fdf1932f86e2
5
5
  SHA512:
6
- metadata.gz: 9a95e5aba3f7e614f88f66eeb33c7ea6046b0a977fc39b87c638de2cad6e7ffad4e751c68392da4533faaec3f5ba40ba44c6792267f07beed5c350a48479163c
7
- data.tar.gz: 31f9e3b7d806b3a095444264e2f56302bfcbca868e88c5690d8ddbf5a119a773a5a4f18109534576ba3ec3b88d13129e9cc5835877ba980de03f7f6571333c85
6
+ metadata.gz: 31eeb4f4ca204efdfa7b323b48968eb1e9a4f50511a1e811a0e171657459b7b6f531d70020befdfd266b7bede99ae326313b5bb38305f1b864e7aaabcc40638a
7
+ data.tar.gz: 1fac59abdcc0142f3ff2f7ff210dc3b2acfa8f5171c4614710791d7540ecd924469dd11743818a31615ee4ec9687b723e80970d055eb1a99bfc73207d901cc78
@@ -0,0 +1,55 @@
1
+ it:
2
+ date:
3
+ day_names: [domenica, lunedì, martedì, mercoledì, giovedì, venerdì, sabato]
4
+ abbr_day_names: [dom, lun, mar, mer, gio, ven, sab]
5
+ # Don't forget the nil at the beginning; there's no such thing as a 0th month
6
+ month_names: [~, gennaio, febbraio, marzo, aprile, maggio, giugno, luglio, agosto, settembre, ottobre, novembre, dicembre]
7
+ abbr_month_names: [~, gen, feb, mar, apr, mag, giu, lug, ago, set, ott, nov, dic]
8
+ seasons:
9
+ spring: "primavera"
10
+ summer: "estate"
11
+ autumn: "autunno"
12
+ winter: "inverno"
13
+ edtf:
14
+ terms:
15
+ approximate_date_prefix_day: "circa "
16
+ approximate_date_prefix_month: "circa "
17
+ approximate_date_prefix_year: "circa "
18
+ approximate_date_suffix_day: ""
19
+ approximate_date_suffix_month: ""
20
+ approximate_date_suffix_year: ""
21
+ decade_prefix: "anni "
22
+ decade_suffix: ""
23
+ century_suffix: ""
24
+ interval_prefix_day: ""
25
+ interval_prefix_month: ""
26
+ interval_prefix_year: ""
27
+ interval_connector_approximate: " - "
28
+ interval_connector_open: " - "
29
+ interval_connector_day: " - "
30
+ interval_connector_month: " - "
31
+ interval_connector_year: " - "
32
+ interval_unspecified_suffix: ""
33
+ open_start_interval_with_day: "fino a %{date}"
34
+ open_start_interval_with_month: "fino a %{date}"
35
+ open_start_interval_with_year: "fino a %{date}"
36
+ open_end_interval_with_day: "%{date} - "
37
+ open_end_interval_with_month: "%{date} - "
38
+ open_end_interval_with_year: "%{date} - "
39
+ set_dates_connector_exclusive: ", "
40
+ set_dates_connector_inclusive: ", "
41
+ set_earlier_prefix_exclusive: "prima di "
42
+ set_earlier_prefix_inclusive: "prima di "
43
+ set_last_date_connector_exclusive: " o "
44
+ set_last_date_connector_inclusive: " e "
45
+ set_later_prefix_exclusive: "dopo "
46
+ set_later_prefix_inclusive: "dopo "
47
+ set_two_dates_connector_exclusive: " o "
48
+ set_two_dates_connector_inclusive: " e "
49
+ uncertain_date_suffix: " ?"
50
+ unknown: "data sconosciuta"
51
+ unspecified_digit_substitute: "x"
52
+ formats:
53
+ day_precision_strftime_format: "%-d %B %Y"
54
+ month_precision_strftime_format: "%B %Y"
55
+ year_precision_strftime_format: "%Y"
@@ -3,4 +3,4 @@
3
3
  require 'edtf/humanize'
4
4
 
5
5
  I18n.load_path +=
6
- Dir.glob(File.dirname(__FILE__) + '/../config/locales/*.{rb,yml}')
6
+ Dir.glob("#{File.dirname(__FILE__)}/../config/locales/*.{rb,yml}")
@@ -23,6 +23,7 @@ module Edtf
23
23
  require 'edtf/humanize/language/default'
24
24
  require 'edtf/humanize/language/english'
25
25
  require 'edtf/humanize/language/french'
26
+ require 'edtf/humanize/language/italian'
26
27
 
27
28
  EDTF::Decade.include Edtf::Humanize::Decade
28
29
  EDTF::Century.include Edtf::Humanize::Century
@@ -49,7 +50,8 @@ module Edtf
49
50
  @language_strategies = {
50
51
  default: Edtf::Humanize::Language::Default,
51
52
  en: Edtf::Humanize::Language::English,
52
- fr: Edtf::Humanize::Language::French
53
+ fr: Edtf::Humanize::Language::French,
54
+ it: Edtf::Humanize::Language::Italian
53
55
  }
54
56
  end
55
57
 
@@ -104,7 +104,6 @@ module Edtf
104
104
  )
105
105
  display.gsub!(date.year.to_s, year_substitute)
106
106
  end
107
- elsif date
108
107
  end
109
108
  display
110
109
  end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Edtf
4
+ module Humanize
5
+ module Language
6
+ module Italian
7
+ include Default
8
+
9
+ module Century
10
+ extend self
11
+
12
+ def humanizer(date)
13
+ require 'roman'
14
+ "#{(date.year.abs / 100 + 1).to_roman}" \
15
+ "#{century_number_suffix}" \
16
+ "#{century_sign_suffix(date)}"
17
+ end
18
+
19
+ private
20
+
21
+ def century_number_suffix
22
+ ' secolo'
23
+ end
24
+
25
+ def century_sign_suffix(date)
26
+ return ' a. C.' if date.year.negative?
27
+
28
+ ''
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Edtf
4
4
  module Humanize
5
- VERSION = '2.0.0'
5
+ VERSION = '2.0.1'
6
6
  end
7
7
  end
@@ -33,7 +33,7 @@ RSpec.describe Edtf::Humanize do
33
33
  end
34
34
  end
35
35
 
36
- context 'with an appoximate interval'
36
+ context 'with an approximate interval'
37
37
  it 'returns a humanized approximate interval string' do
38
38
  expect(Date.edtf('1970~/1980~').humanize).to(
39
39
  eq('circa 1970 to circa 1980')
@@ -52,7 +52,7 @@ RSpec.describe Edtf::Humanize do
52
52
  end
53
53
  end
54
54
 
55
- context 'with an unspecfic year iso date' do
55
+ context 'with an unspecified year iso date' do
56
56
  it 'returns a humanized unspecified year ISO date string' do
57
57
  expect(Date.edtf('197u').humanize).to eq('197x')
58
58
  end
@@ -33,7 +33,7 @@ RSpec.describe Edtf::Humanize do
33
33
  end
34
34
  end
35
35
 
36
- context 'with an appoximate interval'
36
+ context 'with an approximate interval'
37
37
  it 'returns a humanized approximate interval string' do
38
38
  expect(Date.edtf('1970~/1980~').humanize).to(
39
39
  eq('De 1970 environ à 1980 environ')
@@ -52,7 +52,7 @@ RSpec.describe Edtf::Humanize do
52
52
  end
53
53
  end
54
54
 
55
- context 'with an unspecfic year iso date' do
55
+ context 'with an unspecified year iso date' do
56
56
  it 'returns a humanized unspecified year ISO date string' do
57
57
  expect(Date.edtf('197u').humanize).to eq('197x')
58
58
  end
@@ -0,0 +1,110 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'edtf-humanize'
4
+
5
+ RSpec.describe Edtf::Humanize do
6
+ before do
7
+ I18n.locale = :it
8
+ end
9
+
10
+ it { is_expected.to be_a(Module) }
11
+
12
+ context 'with a decade' do
13
+ it 'returns a humanized decade string' do
14
+ expect(Date.edtf('199x').humanize).to eq('anni 1990')
15
+ end
16
+ end
17
+
18
+ context 'with a century' do
19
+ it 'returns a humanized century string' do
20
+ expect(Date.edtf('19xx').humanize).to eq('XX secolo')
21
+ end
22
+ end
23
+
24
+ context 'with an interval' do
25
+ it 'returns a humanized interval string' do
26
+ expect(Date.edtf('1970/1980').humanize).to eq('1970 - 1980')
27
+ end
28
+ end
29
+
30
+ context 'with an open interval' do
31
+ it 'returns a humanized interval string' do
32
+ expect(Date.edtf('1970/open').humanize).to eq('1970 - ')
33
+ end
34
+ end
35
+
36
+ context 'with an approximate interval'
37
+ it 'returns a humanized approximate interval string' do
38
+ expect(Date.edtf('1970~/1980~').humanize).to(
39
+ eq('circa 1970 - circa 1980')
40
+ )
41
+ end
42
+
43
+ context 'with an iso date' do
44
+ it 'returns a humanized ISO date string' do
45
+ expect(Date.edtf('1975-07-01').humanize).to eq('1 luglio 1975')
46
+ end
47
+ end
48
+
49
+ context 'with an uncertain iso date' do
50
+ it 'returns a humanized uncertain ISO date string' do
51
+ expect(Date.edtf('1975?').humanize).to eq('1975 ?')
52
+ end
53
+ end
54
+
55
+ context 'with an unspecified year iso date' do
56
+ it 'returns a humanized unspecified year ISO date string' do
57
+ expect(Date.edtf('197u').humanize).to eq('197x')
58
+ end
59
+ end
60
+
61
+ context 'with a season' do
62
+ it 'returns a humanized season string' do
63
+ expect(Date.edtf('1975-22').humanize).to eq('estate 1975')
64
+ end
65
+ end
66
+
67
+ context 'with a set' do
68
+ it 'returns a humanized exclusive set string' do
69
+ expect(Date.edtf('[1980, 1981, 1983]').humanize).to(
70
+ eq('1980, 1981 o 1983')
71
+ )
72
+ end
73
+
74
+ it 'returns a humanized inclusive set string' do
75
+ expect(Date.edtf('{1980, 1981, 1983}').humanize).to(
76
+ eq('1980, 1981 e 1983')
77
+ )
78
+ end
79
+
80
+ it 'returns a humanized open (before) exclusive set string' do
81
+ expect(Date.edtf('[..1980]').humanize).to(
82
+ eq('prima di 1980')
83
+ )
84
+ end
85
+
86
+ it 'returns a humanized open (after) exclusive set string' do
87
+ expect(Date.edtf('[1980..]').humanize).to(
88
+ eq('dopo 1980')
89
+ )
90
+ end
91
+
92
+ it 'returns a humanized open (before) inclusive set string' do
93
+ expect(Date.edtf('{..1980}').humanize).to(
94
+ eq('prima di 1980')
95
+ )
96
+ end
97
+
98
+ it 'returns a humanized open (after) inclusive set string' do
99
+ expect(Date.edtf('{1980..}').humanize).to(
100
+ eq('dopo 1980')
101
+ )
102
+ end
103
+ end
104
+
105
+ context 'with an unknown value' do
106
+ it 'returns a humanized unknown string' do
107
+ expect(Date.edtf('uuuu').humanize).to eq('data sconosciuta')
108
+ end
109
+ end
110
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: edtf-humanize
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cory Lown
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-29 00:00:00.000000000 Z
11
+ date: 2020-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -125,6 +125,7 @@ files:
125
125
  - LICENSE.txt
126
126
  - config/locales/en.edtf.yml
127
127
  - config/locales/fr.edtf.yml
128
+ - config/locales/it.edtf.yml
128
129
  - lib/edtf-humanize.rb
129
130
  - lib/edtf/humanize.rb
130
131
  - lib/edtf/humanize/century.rb
@@ -143,12 +144,14 @@ files:
143
144
  - lib/edtf/humanize/language/default/unknown.rb
144
145
  - lib/edtf/humanize/language/english.rb
145
146
  - lib/edtf/humanize/language/french.rb
147
+ - lib/edtf/humanize/language/italian.rb
146
148
  - lib/edtf/humanize/season.rb
147
149
  - lib/edtf/humanize/set.rb
148
150
  - lib/edtf/humanize/unknown.rb
149
151
  - lib/edtf/humanize/version.rb
150
152
  - spec/edtf_humanize_en_spec.rb
151
153
  - spec/edtf_humanize_fr_spec.rb
154
+ - spec/edtf_humanize_it_spec.rb
152
155
  - spec/spec_helper.rb
153
156
  homepage: https://github.com/duke-libraries/edtf-humanize
154
157
  licenses:
@@ -176,4 +179,5 @@ summary: This gem adds a humanize method to EDTF dates.
176
179
  test_files:
177
180
  - spec/spec_helper.rb
178
181
  - spec/edtf_humanize_fr_spec.rb
182
+ - spec/edtf_humanize_it_spec.rb
179
183
  - spec/edtf_humanize_en_spec.rb