i18n_date_range 0.2.2 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: afebdd0ed4c442670f29f0d6a69fd7940c04746782e8e6b75eabc524f7ec4152
4
- data.tar.gz: 8fb9d60ccf6ec85efc202dbc1f14356c867c8930220c4675b6a04316712475fb
3
+ metadata.gz: 71784441c2eaf62622c2fd142dcc74d914aaa6dd1661d08f776b879ec2edd450
4
+ data.tar.gz: 43baa011e8b558a3ee54b76047a629516d63369682a4b07c4085faa36398de56
5
5
  SHA512:
6
- metadata.gz: 4eb6409e48b3a9b0d574ecd56d765c724483d3333da87e7eca1ea1309dd9cb03fefa23281f2563f467184ef0c75dad61bba714de877230c8eb5eb68f597ee2bf
7
- data.tar.gz: 59f39bba2423aa30649a6cc85c2d0940a1d7b54b12312a5ac99682b178decf3308c0dc6b92480409422890b964771dc39cc8b6fe28d398350c3c7a45d25fef0a
6
+ metadata.gz: 55cb4cecd209292ecc54b396c6416677244ede78d94229a169b230f914bca24234aa85bb8e2b5ad03ac933970f4f2987c0e5c99289e251d4406cbd3e8e10238b
7
+ data.tar.gz: cc4f9ff20aa67d77018bf7b9065cd9c45c6c265138a578a90f12f47fcebd775495a485cdc837804b8cc502eda089e6f0c089d5cf4e16322e7009f1e7860e7a51
data/Gemfile.lock CHANGED
@@ -1,97 +1,113 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- i18n_date_range (0.2.2)
4
+ i18n_date_range (1.0.0)
5
5
  rails
6
6
  rails-i18n
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- actioncable (7.0.8)
12
- actionpack (= 7.0.8)
13
- activesupport (= 7.0.8)
11
+ actioncable (7.1.1)
12
+ actionpack (= 7.1.1)
13
+ activesupport (= 7.1.1)
14
14
  nio4r (~> 2.0)
15
15
  websocket-driver (>= 0.6.1)
16
- actionmailbox (7.0.8)
17
- actionpack (= 7.0.8)
18
- activejob (= 7.0.8)
19
- activerecord (= 7.0.8)
20
- activestorage (= 7.0.8)
21
- activesupport (= 7.0.8)
16
+ zeitwerk (~> 2.6)
17
+ actionmailbox (7.1.1)
18
+ actionpack (= 7.1.1)
19
+ activejob (= 7.1.1)
20
+ activerecord (= 7.1.1)
21
+ activestorage (= 7.1.1)
22
+ activesupport (= 7.1.1)
22
23
  mail (>= 2.7.1)
23
24
  net-imap
24
25
  net-pop
25
26
  net-smtp
26
- actionmailer (7.0.8)
27
- actionpack (= 7.0.8)
28
- actionview (= 7.0.8)
29
- activejob (= 7.0.8)
30
- activesupport (= 7.0.8)
27
+ actionmailer (7.1.1)
28
+ actionpack (= 7.1.1)
29
+ actionview (= 7.1.1)
30
+ activejob (= 7.1.1)
31
+ activesupport (= 7.1.1)
31
32
  mail (~> 2.5, >= 2.5.4)
32
33
  net-imap
33
34
  net-pop
34
35
  net-smtp
35
- rails-dom-testing (~> 2.0)
36
- actionpack (7.0.8)
37
- actionview (= 7.0.8)
38
- activesupport (= 7.0.8)
39
- rack (~> 2.0, >= 2.2.4)
36
+ rails-dom-testing (~> 2.2)
37
+ actionpack (7.1.1)
38
+ actionview (= 7.1.1)
39
+ activesupport (= 7.1.1)
40
+ nokogiri (>= 1.8.5)
41
+ rack (>= 2.2.4)
42
+ rack-session (>= 1.0.1)
40
43
  rack-test (>= 0.6.3)
41
- rails-dom-testing (~> 2.0)
42
- rails-html-sanitizer (~> 1.0, >= 1.2.0)
43
- actiontext (7.0.8)
44
- actionpack (= 7.0.8)
45
- activerecord (= 7.0.8)
46
- activestorage (= 7.0.8)
47
- activesupport (= 7.0.8)
44
+ rails-dom-testing (~> 2.2)
45
+ rails-html-sanitizer (~> 1.6)
46
+ actiontext (7.1.1)
47
+ actionpack (= 7.1.1)
48
+ activerecord (= 7.1.1)
49
+ activestorage (= 7.1.1)
50
+ activesupport (= 7.1.1)
48
51
  globalid (>= 0.6.0)
49
52
  nokogiri (>= 1.8.5)
50
- actionview (7.0.8)
51
- activesupport (= 7.0.8)
53
+ actionview (7.1.1)
54
+ activesupport (= 7.1.1)
52
55
  builder (~> 3.1)
53
- erubi (~> 1.4)
54
- rails-dom-testing (~> 2.0)
55
- rails-html-sanitizer (~> 1.1, >= 1.2.0)
56
- activejob (7.0.8)
57
- activesupport (= 7.0.8)
56
+ erubi (~> 1.11)
57
+ rails-dom-testing (~> 2.2)
58
+ rails-html-sanitizer (~> 1.6)
59
+ activejob (7.1.1)
60
+ activesupport (= 7.1.1)
58
61
  globalid (>= 0.3.6)
59
- activemodel (7.0.8)
60
- activesupport (= 7.0.8)
61
- activerecord (7.0.8)
62
- activemodel (= 7.0.8)
63
- activesupport (= 7.0.8)
64
- activestorage (7.0.8)
65
- actionpack (= 7.0.8)
66
- activejob (= 7.0.8)
67
- activerecord (= 7.0.8)
68
- activesupport (= 7.0.8)
62
+ activemodel (7.1.1)
63
+ activesupport (= 7.1.1)
64
+ activerecord (7.1.1)
65
+ activemodel (= 7.1.1)
66
+ activesupport (= 7.1.1)
67
+ timeout (>= 0.4.0)
68
+ activestorage (7.1.1)
69
+ actionpack (= 7.1.1)
70
+ activejob (= 7.1.1)
71
+ activerecord (= 7.1.1)
72
+ activesupport (= 7.1.1)
69
73
  marcel (~> 1.0)
70
- mini_mime (>= 1.1.0)
71
- activesupport (7.0.8)
74
+ activesupport (7.1.1)
75
+ base64
76
+ bigdecimal
72
77
  concurrent-ruby (~> 1.0, >= 1.0.2)
78
+ connection_pool (>= 2.2.5)
79
+ drb
73
80
  i18n (>= 1.6, < 2)
74
81
  minitest (>= 5.1)
82
+ mutex_m
75
83
  tzinfo (~> 2.0)
76
84
  ast (2.4.2)
77
85
  base64 (0.1.1)
86
+ bigdecimal (3.1.4)
78
87
  builder (3.2.4)
79
88
  combustion (1.3.7)
80
89
  activesupport (>= 3.0.0)
81
90
  railties (>= 3.0.0)
82
91
  thor (>= 0.14.6)
83
92
  concurrent-ruby (1.2.2)
93
+ connection_pool (2.4.1)
84
94
  crass (1.0.6)
85
95
  date (3.3.3)
86
96
  diff-lcs (1.5.0)
97
+ drb (2.1.1)
98
+ ruby2_keywords
87
99
  erubi (1.12.0)
88
100
  globalid (1.2.1)
89
101
  activesupport (>= 6.1)
90
102
  i18n (1.14.1)
91
103
  concurrent-ruby (~> 1.0)
104
+ io-console (0.6.0)
105
+ irb (1.8.3)
106
+ rdoc
107
+ reline (>= 0.3.8)
92
108
  json (2.6.3)
93
109
  language_server-protocol (3.17.0.3)
94
- loofah (2.21.3)
110
+ loofah (2.21.4)
95
111
  crass (~> 1.0.2)
96
112
  nokogiri (>= 1.12.0)
97
113
  mail (2.8.1)
@@ -100,43 +116,50 @@ GEM
100
116
  net-pop
101
117
  net-smtp
102
118
  marcel (1.0.2)
103
- method_source (1.0.0)
104
119
  mini_mime (1.1.5)
105
120
  minitest (5.20.0)
106
- net-imap (0.3.7)
121
+ mutex_m (0.1.2)
122
+ net-imap (0.4.3)
107
123
  date
108
124
  net-protocol
109
125
  net-pop (0.1.2)
110
126
  net-protocol
111
127
  net-protocol (0.2.1)
112
128
  timeout
113
- net-smtp (0.3.3)
129
+ net-smtp (0.4.0)
114
130
  net-protocol
115
131
  nio4r (2.5.9)
116
132
  nokogiri (1.15.4-x86_64-darwin)
117
133
  racc (~> 1.4)
118
134
  parallel (1.23.0)
119
- parser (3.2.2.3)
135
+ parser (3.2.2.4)
120
136
  ast (~> 2.4.1)
121
137
  racc
138
+ psych (5.1.1.1)
139
+ stringio
122
140
  racc (1.7.1)
123
- rack (2.2.8)
141
+ rack (3.0.8)
142
+ rack-session (2.0.0)
143
+ rack (>= 3.0.0)
124
144
  rack-test (2.1.0)
125
145
  rack (>= 1.3)
126
- rails (7.0.8)
127
- actioncable (= 7.0.8)
128
- actionmailbox (= 7.0.8)
129
- actionmailer (= 7.0.8)
130
- actionpack (= 7.0.8)
131
- actiontext (= 7.0.8)
132
- actionview (= 7.0.8)
133
- activejob (= 7.0.8)
134
- activemodel (= 7.0.8)
135
- activerecord (= 7.0.8)
136
- activestorage (= 7.0.8)
137
- activesupport (= 7.0.8)
146
+ rackup (2.1.0)
147
+ rack (>= 3)
148
+ webrick (~> 1.8)
149
+ rails (7.1.1)
150
+ actioncable (= 7.1.1)
151
+ actionmailbox (= 7.1.1)
152
+ actionmailer (= 7.1.1)
153
+ actionpack (= 7.1.1)
154
+ actiontext (= 7.1.1)
155
+ actionview (= 7.1.1)
156
+ activejob (= 7.1.1)
157
+ activemodel (= 7.1.1)
158
+ activerecord (= 7.1.1)
159
+ activestorage (= 7.1.1)
160
+ activesupport (= 7.1.1)
138
161
  bundler (>= 1.15.0)
139
- railties (= 7.0.8)
162
+ railties (= 7.1.1)
140
163
  rails-dom-testing (2.2.0)
141
164
  activesupport (>= 5.0.0)
142
165
  minitest
@@ -147,16 +170,21 @@ GEM
147
170
  rails-i18n (7.0.8)
148
171
  i18n (>= 0.7, < 2)
149
172
  railties (>= 6.0.0, < 8)
150
- railties (7.0.8)
151
- actionpack (= 7.0.8)
152
- activesupport (= 7.0.8)
153
- method_source
173
+ railties (7.1.1)
174
+ actionpack (= 7.1.1)
175
+ activesupport (= 7.1.1)
176
+ irb
177
+ rackup (>= 1.0.0)
154
178
  rake (>= 12.2)
155
- thor (~> 1.0)
156
- zeitwerk (~> 2.5)
179
+ thor (~> 1.0, >= 1.2.2)
180
+ zeitwerk (~> 2.6)
157
181
  rainbow (3.1.1)
158
- rake (13.0.6)
159
- regexp_parser (2.8.1)
182
+ rake (13.1.0)
183
+ rdoc (6.5.0)
184
+ psych (>= 4.0.0)
185
+ regexp_parser (2.8.2)
186
+ reline (0.3.9)
187
+ io-console (~> 0.5)
160
188
  rexml (3.2.6)
161
189
  rspec (3.12.0)
162
190
  rspec-core (~> 3.12.0)
@@ -179,34 +207,36 @@ GEM
179
207
  rspec-mocks (~> 3.12)
180
208
  rspec-support (~> 3.12)
181
209
  rspec-support (3.12.1)
182
- rubocop (1.56.2)
183
- base64 (~> 0.1.1)
210
+ rubocop (1.57.2)
184
211
  json (~> 2.3)
185
212
  language_server-protocol (>= 3.17.0)
186
213
  parallel (~> 1.10)
187
- parser (>= 3.2.2.3)
214
+ parser (>= 3.2.2.4)
188
215
  rainbow (>= 2.2.2, < 4.0)
189
216
  regexp_parser (>= 1.8, < 3.0)
190
217
  rexml (>= 3.2.5, < 4.0)
191
218
  rubocop-ast (>= 1.28.1, < 2.0)
192
219
  ruby-progressbar (~> 1.7)
193
220
  unicode-display_width (>= 2.4.0, < 3.0)
194
- rubocop-ast (1.29.0)
221
+ rubocop-ast (1.30.0)
195
222
  parser (>= 3.2.1.0)
196
- rubocop-rails (2.21.0)
223
+ rubocop-rails (2.22.1)
197
224
  activesupport (>= 4.2.0)
198
225
  rack (>= 1.1)
199
226
  rubocop (>= 1.33.0, < 2.0)
200
227
  ruby-progressbar (1.13.0)
201
- thor (1.2.2)
228
+ ruby2_keywords (0.0.5)
229
+ stringio (3.0.8)
230
+ thor (1.3.0)
202
231
  timeout (0.4.0)
203
232
  tzinfo (2.0.6)
204
233
  concurrent-ruby (~> 1.0)
205
- unicode-display_width (2.4.2)
234
+ unicode-display_width (2.5.0)
235
+ webrick (1.8.1)
206
236
  websocket-driver (0.7.6)
207
237
  websocket-extensions (>= 0.1.0)
208
238
  websocket-extensions (0.1.5)
209
- zeitwerk (2.6.11)
239
+ zeitwerk (2.6.12)
210
240
 
211
241
  PLATFORMS
212
242
  x86_64-darwin-20
@@ -1,15 +1,19 @@
1
1
  en-GB:
2
2
  date_range:
3
- with_to: "From %{from} to %{to}"
4
- without_to: "%{from}"
3
+ one_line:
4
+ with_to: "From %{from} to %{to}"
5
+ without_to: "%{from}"
6
+ two_lines:
7
+ with_to: "%{from}<br>%{to}"
8
+ without_to: "%{from}"
5
9
 
6
10
  date:
7
11
  formats:
8
- rg_short:
12
+ range_short:
9
13
  day: "%-d"
10
14
  day_month: "%-d %B"
11
15
  day_month_year: "%-d %B %Y"
12
- rg_long:
16
+ range_long:
13
17
  day: "%A %-d"
14
18
  day_month: "%A, %-d %B"
15
- day_month_year: "%A, %-d %B %Y"
19
+ day_month_year: "%A, %-d %B %Y"
@@ -1,15 +1,19 @@
1
1
  en:
2
2
  date_range:
3
- with_to: "From %{from} to %{to}"
4
- without_to: "%{from}"
3
+ one_line:
4
+ with_to: "From %{from} to %{to}"
5
+ without_to: "%{from}"
6
+ two_lines:
7
+ with_to: "%{from}<br>%{to}"
8
+ without_to: "%{from}"
5
9
 
6
10
  date:
7
11
  formats:
8
- rg_short:
12
+ range_short:
9
13
  day: "%-d"
10
14
  day_month: "%B %-d"
11
15
  day_month_year: "%B %-d, %Y"
12
- rg_long:
16
+ range_long:
13
17
  day: "%A %-d"
14
18
  day_month: "%A, %B %-d"
15
- day_month_year: "%A, %B %-d, %Y"
19
+ day_month_year: "%A, %B %-d, %Y"
@@ -1,15 +1,19 @@
1
1
  fr:
2
2
  date_range:
3
- with_to: "Du %{from} au %{to}"
4
- without_to: "%{from}"
3
+ one_line:
4
+ with_to: "Du %{from} au %{to}"
5
+ without_to: "%{from}"
6
+ two_lines:
7
+ with_to: "%{from}<br>%{to}"
8
+ without_to: "%{from}"
5
9
 
6
10
  date:
7
11
  formats:
8
- rg_short:
12
+ range_short:
9
13
  day: "%-d"
10
14
  day_month: "%-d %B"
11
15
  day_month_year: "%-d %B %Y"
12
- rg_long:
16
+ range_long:
13
17
  day: "%A %-d"
14
18
  day_month: "%A %-d %B"
15
- day_month_year: "%A %-d %B %Y"
19
+ day_month_year: "%A %-d %B %Y"
@@ -2,16 +2,17 @@
2
2
 
3
3
  # Computing range to choose the correct form
4
4
  class I18nDateRangeGenerator
5
- attr_reader :from_date, :to_date, :format
5
+ attr_reader :from_date, :to_date, :format, :layout
6
6
 
7
- def self.generate(from_date, to_date, format = :short)
8
- new(from_date, to_date, format).to_s
7
+ def self.generate(from_date, to_date, format: :short, layout: :one_line)
8
+ new(from_date, to_date, format: format, layout: layout).to_s
9
9
  end
10
10
 
11
- def initialize(from_date, to_date, format = :short)
11
+ def initialize(from_date, to_date, format: :short, layout: :one_line)
12
12
  @from_date = from_date
13
13
  @to_date = to_date
14
14
  @format = format
15
+ @layout = layout
15
16
  end
16
17
 
17
18
  def to_s
@@ -26,14 +27,14 @@ class I18nDateRangeGenerator
26
27
 
27
28
  def without_to
28
29
  I18n.t(
29
- "date_range.without_to",
30
+ "date_range.#{layout}.without_to",
30
31
  from: format_date(from_date, :day_month_year)
31
32
  ).capitalize
32
33
  end
33
34
 
34
35
  def with_to
35
36
  I18n.t(
36
- "date_range.with_to",
37
+ "date_range.#{layout}.with_to",
37
38
  from: format_date(from_date, from_format),
38
39
  to: format_date(to_date, :day_month_year)
39
40
  ).capitalize
@@ -50,7 +51,7 @@ class I18nDateRangeGenerator
50
51
  def format_date(date, key)
51
52
  I18n.l(
52
53
  date,
53
- format: "rg_#{format}.#{key}".to_sym
54
+ format: "range_#{format}.#{key}".to_sym
54
55
  )
55
56
  end
56
57
 
@@ -3,8 +3,11 @@
3
3
  # Rails helper
4
4
  # Format can be :short (default) or :long
5
5
  # <%= date_range_i18n(start, end, :long)
6
+ # Layout can be :one_line (default) or :two_lines, other might be necessary in the future
6
7
  module I18nDateRangeHelper
7
- def date_range_i18n(from, to = nil, format = :short)
8
- I18nDateRangeGenerator.generate(from, to, format)
8
+
9
+ def date_range_i18n(from, to = nil, format: nil, layout: nil)
10
+ I18nDateRangeGenerator.generate(*args)
9
11
  end
12
+
10
13
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module I18nDateRange
4
- VERSION = "0.2.2"
4
+ VERSION = "1.0.0"
5
5
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: i18n_date_range
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - pabois
8
8
  - arnaudlevy
9
- autorequire:
9
+ autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2023-10-06 00:00:00.000000000 Z
12
+ date: 2023-10-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -172,7 +172,7 @@ metadata:
172
172
  homepage_uri: https://github.com/noesya/i18n_date_range
173
173
  source_code_uri: https://github.com/noesya/i18n_date_range
174
174
  changelog_uri: https://github.com/noesya/i18n_date_range/CHANGELOG.md
175
- post_install_message:
175
+ post_install_message:
176
176
  rdoc_options: []
177
177
  require_paths:
178
178
  - lib
@@ -187,8 +187,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
187
187
  - !ruby/object:Gem::Version
188
188
  version: '0'
189
189
  requirements: []
190
- rubygems_version: 3.1.4
191
- signing_key:
190
+ rubygems_version: 3.4.6
191
+ signing_key:
192
192
  specification_version: 4
193
193
  summary: Add helper to display a date range
194
194
  test_files: []