l10n 2.0.1 → 2.2.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: bd3f8a0bc047817f4a774f48cb0584f7179b7b9e5b9857fbe4b56aa8bd4ca6c2
4
- data.tar.gz: f1bbab93ef1b9553cfd81575d5f06fb51ac6334fb9437c2e2de1c8a43caf626a
3
+ metadata.gz: 1be2e544d58d781864749ead7f43db89099ae84cf1bfdb70227b6219a3cead87
4
+ data.tar.gz: 4e7ac3473aad904ef817caf8ce47ab3f44eee477efbee945d5afe1c90fb48d1b
5
5
  SHA512:
6
- metadata.gz: 23839e9b5e634487d88f31831d5c418e5695beaf7885f3f313fafa3d1a7ccd4b666fd2b7baee8530411d0f7114ab99221cd183f33c03e06a6d8a6d17a45bd529
7
- data.tar.gz: fbc6874864dc62627c13d146137342cde276ef76b10bfe25a9549286c609c10c140830ebf971dac1076eb1fea492bdf9eab637a13d382d62254d7d740e078a9d
6
+ metadata.gz: cbb29df1f4901852712dd46dc52ba11466b6a0a2f7937f0f230649b5c6f6fe60d4b4d76d4670280335225e60430889a66610d0f60672d5317f57c24f2761a457
7
+ data.tar.gz: 6daf99f72e40a9a3b0c01aba698e00428be462c7bb1dcb3333799ac9c92869be795ba1e945b016da1a327bb9e23f086d2bd46bd8600ac7b27d3d175d0ce09284
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## 2.2.1 - 2024-08-16
2
+
3
+ - Support Rails 7.2
4
+
5
+ ## 2.2.0 - 2023-11-09
6
+
7
+ - Support Rails 7.1
8
+
9
+ ## 2.1.0 - 2023-05-25
10
+
11
+ - ActiveModel attribute delocalization
12
+
1
13
  ## 2.0.1 - 2023-05-09
2
14
 
3
15
  - Fix method delegation
data/README.md CHANGED
@@ -115,7 +115,7 @@ This also works with `BigDecimal`s.
115
115
  #### Localization of decimal separator and delimiter for numbers
116
116
 
117
117
  Localization converts decimal separators and delimiters between locales without
118
- re-formatting strings. `to_localized_s` can be called on any object.
118
+ re-formatting strings. `to_ls` can be called on any object.
119
119
 
120
120
  ```ruby
121
121
  I18n.as('de') { 1234.5.to_localized_s } => "1.234,5"
@@ -22,6 +22,7 @@ module L10n
22
22
  def to_localized_s
23
23
  Numeric.localize(self)
24
24
  end
25
+ alias_method :to_ls, :to_localized_s
25
26
  end
26
27
 
27
28
  module Formatting
@@ -1,18 +1,17 @@
1
- require 'active_record'
1
+ require 'active_model'
2
2
 
3
3
  module L10n
4
4
  module NumericColumnConversions
5
5
 
6
- def _write_attribute(attr_name, value)
7
- column = column_for_attribute(attr_name.to_s)
8
- if column && [:integer, :float, :decimal].include?(column.type) && value.is_a?(String)
6
+ def from_user(name, value, type, original_attribute = nil)
7
+ if [:integer, :float, :decimal].include?(type.try(:type)) && value.is_a?(String)
9
8
  value = Numeric.delocalize(value)
10
9
  end
11
- super(attr_name, value)
10
+ super(name, value, type, original_attribute)
12
11
  end
13
-
12
+
14
13
  end
15
-
14
+
16
15
  end
17
16
 
18
- ActiveRecord::Base.prepend L10n::NumericColumnConversions
17
+ ActiveModel::Attribute.singleton_class.prepend L10n::NumericColumnConversions
data/lib/l10n/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module L10n
2
- VERSION = '2.0.1'
2
+ VERSION = '2.2.1'
3
3
  end
data/lib/l10n.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require 'i18n'
2
2
  require 'date'
3
3
  require 'bigdecimal'
4
+ require 'active_record'
4
5
  require 'action_view'
5
6
  require 'action_dispatch'
6
7
  require 'active_support/all'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: l10n
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthias Grosser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-29 00:00:00.000000000 Z
11
+ date: 2024-08-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -31,9 +31,9 @@ dependencies:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: 7.0.0
34
- - - "<"
34
+ - - "~>"
35
35
  - !ruby/object:Gem::Version
36
- version: '7.1'
36
+ version: '7.2'
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
@@ -41,9 +41,9 @@ dependencies:
41
41
  - - ">="
42
42
  - !ruby/object:Gem::Version
43
43
  version: 7.0.0
44
- - - "<"
44
+ - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '7.1'
46
+ version: '7.2'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: activesupport
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -51,9 +51,9 @@ dependencies:
51
51
  - - ">="
52
52
  - !ruby/object:Gem::Version
53
53
  version: 7.0.0
54
- - - "<"
54
+ - - "~>"
55
55
  - !ruby/object:Gem::Version
56
- version: '7.1'
56
+ version: '7.2'
57
57
  type: :runtime
58
58
  prerelease: false
59
59
  version_requirements: !ruby/object:Gem::Requirement
@@ -61,9 +61,9 @@ dependencies:
61
61
  - - ">="
62
62
  - !ruby/object:Gem::Version
63
63
  version: 7.0.0
64
- - - "<"
64
+ - - "~>"
65
65
  - !ruby/object:Gem::Version
66
- version: '7.1'
66
+ version: '7.2'
67
67
  - !ruby/object:Gem::Dependency
68
68
  name: actionpack
69
69
  requirement: !ruby/object:Gem::Requirement
@@ -71,9 +71,9 @@ dependencies:
71
71
  - - ">="
72
72
  - !ruby/object:Gem::Version
73
73
  version: 7.0.0
74
- - - "<"
74
+ - - "~>"
75
75
  - !ruby/object:Gem::Version
76
- version: '7.1'
76
+ version: '7.2'
77
77
  type: :runtime
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
@@ -81,9 +81,9 @@ dependencies:
81
81
  - - ">="
82
82
  - !ruby/object:Gem::Version
83
83
  version: 7.0.0
84
- - - "<"
84
+ - - "~>"
85
85
  - !ruby/object:Gem::Version
86
- version: '7.1'
86
+ version: '7.2'
87
87
  - !ruby/object:Gem::Dependency
88
88
  name: railties
89
89
  requirement: !ruby/object:Gem::Requirement
@@ -91,9 +91,9 @@ dependencies:
91
91
  - - ">="
92
92
  - !ruby/object:Gem::Version
93
93
  version: 7.0.0
94
- - - "<"
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '7.1'
96
+ version: '7.2'
97
97
  type: :runtime
98
98
  prerelease: false
99
99
  version_requirements: !ruby/object:Gem::Requirement
@@ -101,9 +101,9 @@ dependencies:
101
101
  - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: 7.0.0
104
- - - "<"
104
+ - - "~>"
105
105
  - !ruby/object:Gem::Version
106
- version: '7.1'
106
+ version: '7.2'
107
107
  description: Extensions for Rails I18n
108
108
  email: mtgrosser@gmx.net
109
109
  executables: []
@@ -151,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
153
  requirements: []
154
- rubygems_version: 3.1.4
154
+ rubygems_version: 3.4.10
155
155
  signing_key:
156
156
  specification_version: 4
157
157
  summary: Make I18n roar again